Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on React: You Might Not Need an Effect. Parent comment
You can confirm this via console.log:
useMemo(() => console.log(1), []) console.log(2)
… will print 1 then 2.
If you replace useMemo with useLayoutEffect, you’ll get 2 then 1.
There are no comments on this comment yet.
You can confirm this via console.log:
useMemo(() => console.log(1), []) console.log(2)
… will print 1 then 2.
If you replace useMemo with useLayoutEffect, you’ll get 2 then 1.