When should I use componentWillReceiveProps?
Similarly, you may ask, when should I use componentWillMount?
componentWillMount runs before initial rendering. But it is not advised to do any subscriptions and state setting in this method. If you want to some of that before rendering you can use the constructor of the component. componentDidMount() instead.
Likewise, when should I use componentDidUpdate?
The componentDidUpdate is particularly useful when an operation needs to happen after the DOM is updated and the update queue is emptied. It's probably most useful on complex renders and state or DOM changes or when you need something to be the absolutely last thing to be executed.
componentDidMount() is only called once, on the client, compared to componentWillMount() which is called twice, once to the server and once on the client. It is called after the initial render when the client received data from the server and before the data is displayed in the browser.