react生命周期的学习与总结
发布日期:2021-05-11 00:28:52 浏览次数:12 分类:精选文章

本文共 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 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������

    上一篇:js节流与防抖的代码实现与应用场景简述
    下一篇:关于react路由的学习总结

    发表评论

    最新留言

    做的很好,不错不错
    [***.243.131.199]2025年04月12日 06时17分10秒