根据这个页面http://busypeoples.github.io/post/react-component-lifecycle/组件的渲染方法在其他地方的componentWillMount
和componentDidMount
方法之间被调用。
但是这里的组件生命周期的 react.js 文档https://facebook.github.io/react/docs/component-specs.html说componentDidMount
所有子活动的方法都在父活动之前调用。我可以理解componentDidMount
在渲染任何子组件之后调用是可以的,但是运行时如何知道componentWillMount
在渲染之前调用哪些子组件?或者我假设componentWillMount
首先调用父活动然后调用孩子(不像componentDidMount
)是正确的吗?
谢谢!