
本文共 3023 字,大约阅读时间需要 10 分钟。
React������������������������������������������������������������������������������������������������������������������������������������
initial���������������������������������������������������������������props���������������state������������������������������������������������������������������ lifecycle componentWillMount
���
mounting��������������������������������������������������������������������������������� componentWillMount
������������������������������������ componentDidMount
��������������������������������������������� DOM ���������������������
updating���������������������������������������������React ������������ shouldComponentUpdate
��������������������������� true
������������������ true
��������������������������������������������������������������������� componentWillUpdate
������������������������������������ componentDidUpdate
���������������
unmounted���������������������������������������componentWillUnmount
��������������������������������������������� DOM ��������������������������������������������������������� subscriptions���
��������������������������������� React 16.3 ������������������������������������������������������������������������������������������������
- ������������
static getDerivedStateFromProps
������������������������������������������������������������������������ - ���������������������
- ������������
componentDidMount
���������������
���������������������������������componentWillMount
��� componentDidMount
������������������������������������������������������������������������������������
������������������������������������������������������������������ getDerivedStateFromProps
���������������������������������������������������������������������
- ������������
getDerivedStateFromProps
��������������������������������� - ������������
shouldComponentUpdate
������������������������������������������������ - ���������������������������������
getSnapShotBeforeUpdate
��������������������������������� - ������������
componentDidUpdate
���������������
���������������
// ���������������������������������������������������componentWillMount() { // ������������������������������������}componentDidMount() { // ������������������������������������������������������������������}// ���������������������������������������������shouldComponentUpdate(nextProps, nextState) { // ��������������������������������������������� if (nextState.count !== this.state.count) { console.log("shouldComponentUpdate"); return true; } return false;}// ������������������������������componentWillUpdate() { // ���������������������������������������������������������}componentDidUpdate() { // ������������������������������}// ������������������������������componentWillUnmount() { // ���������������������������������������������������}
������������������������ React ������������������������������������������������������������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
