4 ms·
To nitpick: calling setState in componentWillMount does not cause a re-render, so as long as it is not dependent on an async function it does not technically hu
by holdenc 9y ago
To nitpick: calling setState in componentWillMount does not cause a re-render, so as long as it is not dependent on an async function it does not technically hurt your app -- even though the docs state that initializing non-async state in the constructor is preferred.
https://reactjs.org/docs/react-component.html#componentwillmount https://reactjs.org/docs/react-component.html#componentwillm...