diff options
Diffstat (limited to 'src/App.tsx')
| -rw-r--r-- | src/App.tsx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..8845354 --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,25 @@ +import { useEffect, useState } from "react"; +import Router from "./Router"; +import { setNobelPrizes } from "./data"; + +let loadOnce = false; +function App() { + const [loading, setLoading] = useState(true); + useEffect(() => { + (async () => { + if (loadOnce === false) { + loadOnce = true; + await setNobelPrizes(); + setLoading(false); + } + })(); + }, []); + + if (loading) { + return <>Loading nobel prizes</>; + } else { + return <Router />; + } +} + +export default App; |
