React documents recommended componentDidMount
for creating network requests
componentDidMount()
called immediately after the component is installed. Initialization requiring DOM nodes should go here. If you need to download data from a remote endpoint, this is a good place to create a network request.
setState()
, . , render()
, .
componentWillMount
:
. , .
"" , . componentWillMount
setTimeout
- . - , .
componentDidMount
- :
- DidMount ,
.
,
undefined
,
. - - ,
componentWillMount
- , -
, , .
componentDidMount
.