I am reading up on react lifecycle and am getting a little confused. Some recommend using componentWillMount to make ajax calls:
Calling setState in componentDidMount will trigger another render() call and it can lead to layout thrashing.
and in other places it says not to put ajax calls in the componentWillMount:
https://medium.com/@baphemot/understanding-reactjs-component-life-cycle-823a640b3e8d
...this function might end up being called multiple times before the initial render is called so might result in triggering multiple side-effects. Due to this fact it is not recommended to use this function for any side-effect causing operations.
Which is correct?