As in title: how can I do something while all components are mounted in React? I'd like to run script which needs all my components to be mounted.
React
knows to mount first all child
components before calling componentDidMount
on the parent component
.
So, you can use componentDidMount
callback method in your main component
.
As soon as the render
method has been executed, the componentDidMount
function is called. The DOM
can be accessed in this method, enabling to define DOM
manipulations or data fetching operations.