3 ms·
Yes. Our recommendation is to put such values on the state (like state.prevRow in the blog post example). This frees up React to not hold into the whole previo
by danabramov 9y ago
Yes. Our recommendation is to put such values on the state (like state.prevRow in the blog post example).
This frees up React to not hold into the whole previous props object in some cases in future versions.
It’s a bit more verbose but it also solves the problem of prevProps being null on first render (and thus forcing you to write an extra check every time you use this method).