Last active
November 5, 2020 10:39
-
-
Save peterfleck/a593284aa3085bc8734b5409b5d69cf5 to your computer and use it in GitHub Desktop.
Revisions
-
peterfleck revised this gist
Nov 5, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,4 +11,5 @@ export default function Home() { }, []); return <>{data}</>; } ``` -
peterfleck revised this gist
Nov 5, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ```import React, { useEffect, useState } from "react"; export default function Home() { const [data, setData] = useState(); @@ -11,4 +11,4 @@ export default function Home() { }, []); return <>{data}</>; }``` -
peterfleck created this gist
Nov 5, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ import React, { useEffect, useState } from "react"; export default function Home() { const [data, setData] = useState(); useEffect(() => { const interval = setInterval(() => { setData((data) => new Date(Date.now()).toLocaleTimeString()); }, 5000); return () => clearInterval(interval); }, []); return <>{data}</>; }