Hacker News new | ask | show | jobs
by throwthrow0987 455 days ago
So why is barData being recomputed? Does anyone understand how React compiler works enough to answer this?
1 comments

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.