mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
refactor: improve app startup perf many times
This commit is contained in:
16
apps/web/src/hooks/use-database.js
Normal file
16
apps/web/src/hooks/use-database.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { initializeDatabase } from "../common/db";
|
||||
|
||||
export default function useDatabase() {
|
||||
const [isAppLoaded, setIsAppLoaded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
await import("../app.css");
|
||||
await initializeDatabase();
|
||||
setIsAppLoaded(true);
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return [isAppLoaded];
|
||||
}
|
||||
Reference in New Issue
Block a user