7 ms·
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 `getSnapshotBefor
by djhartman 8y ago
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.
- brianvaughn 8y ago> 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-lifecycle-methods.md#common-problems 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.