---
title: "Comment by Victory Asokomeh on \"Common React Hooks cheatsheet - React, Redux, Router and Ionic friendly\" | Hashnode"
description: "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"
url: "https://hashnode.com/posts/common-react-hooks-cheatsheet-react-redux-router-and-ionic-friendly/5fc6d092a0a3250b19a58895/comment/5fc7948e6819c54efdf2deb1"
---

[Discussion](https://hashnode.com/posts/common-react-hooks-cheatsheet-react-redux-router-and-ionic-friendly/5fc6d092a0a3250b19a58895)

Comment [Common React Hooks cheatsheet - React, Redux, Router and Ionic friendly](https://hashnode.com/posts/common-react-hooks-cheatsheet-react-redux-router-and-ionic-friendly/5fc6d092a0a3250b19a58895)

[Victory Asokomeh](https://hashnode.com/@Soks)

[Dec 2, 2020](https://hashnode.com/posts/common-react-hooks-cheatsheet-react-redux-router-and-ionic-friendly/5fc6d092a0a3250b19a58895/comment/5fc7948e6819c54efdf2deb1)

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.

-   Verifying user token when your root component mounts (app)

const { handleLogout } = useAuth();

useLayoutEffect(() => { checkTokenValidity(handleLogout); }, \[handleLogout\]);
