mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
23 lines
502 B
JavaScript
23 lines
502 B
JavaScript
import { useEffect, useState } from "react";
|
|
import { initializeDatabase } from "../common/db";
|
|
|
|
const memory = {
|
|
isAppLoaded: false,
|
|
};
|
|
export default function useDatabase() {
|
|
const [isAppLoaded, setIsAppLoaded] = useState(memory.isAppLoaded);
|
|
|
|
useEffect(() => {
|
|
if (memory.isAppLoaded) return;
|
|
|
|
(async () => {
|
|
await import("../app.css");
|
|
await initializeDatabase();
|
|
setIsAppLoaded(true);
|
|
memory.isAppLoaded = true;
|
|
})();
|
|
}, []);
|
|
|
|
return [isAppLoaded];
|
|
}
|