setState() in componentWillMount()
Last updated
Was this helpful?
Last updated
Was this helpful?
Avoid async initialization in componentWillMount()
componentWillMount()
is invoked immediately before mounting occurs. It is called before render()
, therefore setting state in this method will not trigger a re-render. Avoid introducing any side-effects or subscriptions in this method.
Make async calls for component initialization in componentDidMount
instead of componentWillMount