Created
May 30, 2023 15:13
-
-
Save Arlement/8d4b55d3f5b45b479fbeb92f20229c07 to your computer and use it in GitHub Desktop.
Mounting Method SSR
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
| import { useEffect, useState } from "react" | |
| export default function Index(){ | |
| const [mounted, setMounted] = useState(false) | |
| useEffect(() => { | |
| setMounted(true) | |
| }) | |
| if (!mounted) { | |
| return null | |
| } | |
| return ( | |
| <div> | |
| <h1>TESTING</h1> | |
| </div> | |
| ) | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's great to hear! SSR can really be a pain sometimes, but it really does have it's benefits sometimes.