Last active
November 9, 2020 21:12
-
-
Save kellenmace/50d45471d3c874396011598d9260e4c2 to your computer and use it in GitHub Desktop.
Example of using useHasMounted() hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Greeting() { | |
const hasMounted = useHasMounted(); | |
const username = hasMounted ? localStorage.getItem("username") : null; | |
return <p>Welcome back {username}!</p>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment