News for hackers. Stuff that matters.
Re:React v16.3.0: New lifecycles and context API by WhitneyLand on Thursday March 29, 2018 @09:58PM (#16713044)
Developer learning curve: The context name is a good choice I think. Context API sounds much more elegant than global variables API.

While that’s a little tongue in cheek, the lifecycle method names I would rate as a drastic drop in intuitiveness:

Previous:

  componentWillMount

  componentWillReceiveProps

  componentWillUpdate
New:

  getDerivedStateFromProps

  getSnapshotBeforeUpdate
Re:React v16.3.0: New lifecycles and context API by danabramov on Thursday March 29, 2018 @10:15PM (#16713136)
This is intentional because those are relatively rare use cases. We want them to stand out and be quite specific about what they're doing.

You still have `componentDidMount`, `componentDidUpdate`, and `componentWillUnmount` that should be used more commonly and do exactly what you expect them to.

Re:React v16.3.0: New lifecycles and context API by djhartman on Friday March 30, 2018 @01:03PM (#16717812)
In your experience, what are the kind of things that people do in `componentWillMount` that they shouldn't be doing? Is it correct to say that `getSnapshotBeforeUpdate` is named to indicate what you were supposed to use `componentWillMount` for?

Thanks to you and brianvaughn for answering so many questions.

Re:React v16.3.0: New lifecycles and context API by brianvaughn on Friday March 30, 2018 @01:35PM (#16718102)
> In your experience, what are the kind of things that people do in `componentWillMount` that they shouldn't be doing?

The biggest one is probably adding event listeners or setting up subscriptions (which can cause memory leaks).

Here are some others: https://github.com/reactjs/rfcs/blob/master/text/0006-static...

> Is it correct to say that `getSnapshotBeforeUpdate` is named to indicate what you were supposed to use `componentWillMount` for?

No. `getSnapshotBeforeUpdate` is not really related to `componentWillMount`. It relates more to what people were using `componentWillUpdate` for.