react.dev icon indicating copy to clipboard operation
react.dev copied to clipboard

Document memoization as alternative to componentWillReceiveProps

Open gaearon opened this issue 7 years ago • 1 comments

We get a lot of feedback that getDerivedStateFromProps is used for memoization which is not very ergonomic.

Let’s add a recipe about memoizing directly to the docs.

https://twitter.com/brian_d_vaughn/status/987443099537309696?s=20

We should probably use this package:

https://www.npmjs.com/package/memoize-one

It’s important to highlight that we usually recommend memoizing just the last value.

gaearon avatar Apr 21 '18 12:04 gaearon

@gaearon Can I take this?

KenFoss avatar Dec 07 '23 14:12 KenFoss