From 857c528369473a66518407dee6f6cac89bbc538c Mon Sep 17 00:00:00 2001 From: Maksymilian Jopek Date: Wed, 15 Nov 2023 19:29:24 +0100 Subject: Initial commit, v1.0.0 --- src/App.tsx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/App.tsx (limited to 'src/App.tsx') 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 ; + } +} + +export default App; -- cgit v1.3.1