Amy Blankenship
1 min readJul 19, 2022

--

So, PureComponent base Class would only rerender if its state or props had changed. And when you had it in a Class component, you had great control and (if your class component wasn't a hot mess) easy understanding of when either of those things had changed. Now, when everyone is twisting themselves into pretzels trying to only write functional components, it becomes very hard to know when the props are changing (by ref), because everything is constantly being recreated. So, you could create ChildComponent as a PureComponent, but it would _still_ rerender, because `{data: 'something'}` is recreated every time the function runs. While you could wrap that in useMemo, that then requires yet other mental contortions to use correctly. May I have your permission to point to some of your recent posts as examples for part 3 (possibly also part 2) of my series https://medium.com/codex/can-we-all-just-admit-react-hooks-were-a-bad-idea-c48120c5188d? The fact that all these convolutions are necessary to control when components rerender speak volumes!

--

--

Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.