Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

custom hook to detect if localStorage is loaded

Aykut Saraçd3f9cca4d1d1
diff --git a/src/hooks/useLoading.tsx b/src/hooks/useLoading.tsx
new file mode 100644
index 00000000..a219d84f
--- /dev/null
+++ b/src/hooks/useLoading.tsx
@@ -0,0 +1,9 @@
+import { useEffect, useState } from "react";
+
+export const useLoading = () => {
+ const [loaded, setLoaded] = useState(false);
+
+ useEffect(() => setLoaded(true), []);
+
+ return loaded;
+};