fe
fe copied to clipboard
我希望在深入 React 之前知道这些
会玩
即使 props 没有改变,也会调用 componentWillReceiveProps,因此需要在函数内部比较 this.props 和 nextProps
这句话是什么意思不太理解您要表达什么
这句话解释为什么要比较 this.props 和 nextProps,因为即使 props 没有改变,也会调用 componentWillReceiveProps,而 componentWillReceiveProps 默认总是返回 true
理解了 之前没注意过这个细节。 即使没有显性声明的 props 也会调用componentWillReceiveProps。