So who is this for? Frontend developers writing functional React components Ionic React mobile developers React Hooks Hooks provide React developers the ability to write functional components while accessing Reacts core features. To put it plainly:...
blog.chinaza.dev4 min read
A very good explanation about hooks! Keep it up!
useLayoutEffect Similar to useEffect but fires synchronously after all DOM mutations(react docs).
It can be used to make changes before the browser has a chance to paint.
I can think of two instances where it can be applied;
Dynamically setting document title
useLayoutEffect(() => { document.title = "Profile"; }, []);
The page title is set before the browser has a chance to paint.
const { handleLogout } = useAuth();
useLayoutEffect(() => { checkTokenValidity(handleLogout); }, [handleLogout]);
Luísa Ribeiro Bezerra
Software Engineer
Great article! :D