Hacker News new | past | comments | ask | show | jobs | submit login

So why is barData being recomputed? Does anyone understand how React compiler works enough to answer this?



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.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: