When my component mount I need to request it content from an API. In the docs:
componentDidMount() is invoked immediately after a component is mounted. Initialization that requires DOM nodes should go here. If you need to load data from a remote endpoint, this is a good place to instantiate the network request.
and it follows:
Calling setState() in this method will trigger an extra rendering (...) Use this pattern with caution because it often causes performance issues.
What is the best practice to make a request to an API and, immediately, setState with the response?