blob: 5333b77070a233c9214f0beb32edc316a74d8e91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import { Provider, useStore } from "jotai/react";
import { useHydrateAtoms } from "jotai/react/utils";
import { queryClientAtom } from "jotai-tanstack-query";
import { type ReactNode, StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App.tsx";
import { StoreInitializer } from "./components/StoreInitializer";
import "./index.css";
import { queryClient } from "./queryClient";
function HydrateQueryClient({ children }: { children: ReactNode }) {
const store = useStore();
useHydrateAtoms([[queryClientAtom, queryClient]], { store });
return <>{children}</>;
}
// biome-ignore lint/style/noNonNullAssertion: root element is guaranteed to exist
createRoot(document.getElementById("root")!).render(
<StrictMode>
<Provider>
<HydrateQueryClient>
<StoreInitializer>
<App />
</StoreInitializer>
</HydrateQueryClient>
</Provider>
</StrictMode>,
);
|