我在(React.Component)中查看了Facebook的文档,其中提到了如何在客户机/服务器上调用componentWillMount
,而仅在客户机上调用componentDidMount
.componentWillMount
对服务器做了什么?
我在(React.Component)中查看了Facebook的文档,其中提到了如何在客户机/服务器上调用componentWillMount
,而仅在客户机上调用componentDidMount
.componentWillMount
对服务器做了什么?
componentWillMount本质上是构造函数.您可以设置不影响渲染的实例属性,从store synchronously中提取数据并使用它设置状态,以及设置组件时需要运行的其他简单无副作用的代码.
这几乎不需要,ES6课程也不需要.