aboutsummaryrefslogtreecommitdiffstats
path: root/src/App.tsx
diff options
context:
space:
mode:
authorMaksymilian Jopek <maks@jopek.eu>2023-11-15 19:29:24 +0100
committerMaksymilian Jopek <maks@jopek.eu>2023-11-15 19:34:12 +0100
commit857c528369473a66518407dee6f6cac89bbc538c (patch)
treecccf02a369ee6cafb2a89750ee222ebba69d2269 /src/App.tsx
downloadlisteya-xelata-nobele-master.tar.gz
listeya-xelata-nobele-master.tar.zst
listeya-xelata-nobele-master.zip
Initial commit, v1.0.0HEADmaster
Diffstat (limited to 'src/App.tsx')
-rw-r--r--src/App.tsx25
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;