Skip to content

Instantly share code, notes, and snippets.

@Sergioamjr
Created May 22, 2021 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sergioamjr/2d6007cd2c2ddb66c2620f6f9c2ba1e3 to your computer and use it in GitHub Desktop.
Save Sergioamjr/2d6007cd2c2ddb66c2620f6f9c2ba1e3 to your computer and use it in GitHub Desktop.
import { useState, useLayoutEffect } from "react";
function Component() {
const [isDOMLoaded, setIsDOMLoaded] = useState(false);
useLayoutEffect(() => {
setIsDOMLoaded(true);
window.localstorage.getItem("...");
}, []);
return(
//...
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment