News for hackers. Stuff that matters.
Re:React v16.3.0: New lifecycles and context API by hoodoof on Thursday March 29, 2018 @06:32PM (#16711737)
Off topic but Dan - referring to your question to me yesterday I'm curious to your answer:

You asked "Curious, what do you use it for?" in regard to componentWillReceiveProps

https://news.ycombinator.com/item?id=16695064

I use componentWillReceiveProps for just about everything - I had thought it was a fundamental part of the Redux flow. i.e. Redux updates, new props flow through the hierarchy, I pick that up in componentWillReceiveProps and make changes based on new props.

Is this not correct?

Re:React v16.3.0: New lifecycles and context API by brianvaughn on Thursday March 29, 2018 @06:40PM (#16711825)
The purpose of componentWillReceiveProps was to update state in response to props changes. (This is also the purpose of getDerivedStateFromProps.)

What you're describing sounds more like you're updating something external (e.g. your Redux store). This isn't what the lifecycle is meant for, and you'd be better off using componentDidUpdate instead.

Re:React v16.3.0: New lifecycles and context API by spicyj on Thursday March 29, 2018 @06:39PM (#16711818)
Let's keep the discussion on that thread – I just responded there.