Re:Stop Using and Recommending React
by throwthrow0987 on Tuesday March 18, 2025 @06:25AM
(#43397688)
So why is barData being recomputed? Does anyone understand how React compiler works enough to answer this?
[ Parent
| on HN ]
You can see exactly what the React compiler output is by pasting the listed code into the compiler playground:
- https://playground.react.dev/#N4Igzg9grgTgxgUxALhAMygOzgFwJY...
In this case, it looks like the compiler has hoisted the console logs from the `useMemo` calls out into the main body of the function component, because it considers those to be side effects. So, the logs are still occurring. However, the actual child component output _is_ being memoized as expected.