Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It says not to use effects, but then suggests useMemo which is an effect!


I'm not sure that useMemo really is an effect in the sense that useEffect is. The useMemo callback is invoked synchronously during render, rather than getting pushed onto an effect queue like useEffect does.

Even useLayoutEffect goes on an effect queue, and if it results in changes, will need to render a second time, while a changed memo calculation happens entirely during the single render pass.




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

Search: