Skip to content

Commit

Permalink
Merge pull request #306 from SCBJ-7/feature/#305-hydrateRoot
Browse files Browse the repository at this point in the history
[#305] hydrateRoot로 변경
  • Loading branch information
Bumang-Cyber authored Jan 28, 2024
2 parents d63d269 + 4992fa5 commit 236245b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"preview": "vite preview",
"prepare": "husky install",
"test": "vitest",
"generate-pwa-assets": "pwa-assets-generator --preset minimal public/logo.svg"
"generate-pwa-assets": "pwa-assets-generator --preset minimal public/logo.svg",
"postbuild": "react-snap"
},
"lint-staged": {
"*.{ts,tsx}": [
Expand All @@ -37,6 +38,7 @@
"react-icons": "^4.12.0",
"react-modal": "^3.16.1",
"react-router-dom": "^6.21.1",
"react-snap": "^1.23.0",
"react-window": "^1.8.10",
"styled-components": "^6.1.6",
"zustand": "^4.4.7"
Expand Down Expand Up @@ -83,5 +85,11 @@
"workerDirectory": [
"public"
]
},
"reactSnap": {
"include": [
"/"
],
"source": "./dist"
}
}
5 changes: 2 additions & 3 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import { hydrate } from "react-dom";
import ReactDOM from "react-dom/client";
import { HelmetProvider } from "react-helmet-async";
import { ThemeProvider } from "styled-components";
Expand Down Expand Up @@ -35,7 +34,8 @@ if ("serviceWorker" in navigator) {

const rootElement = document.getElementById("root");
if (rootElement?.hasChildNodes()) {
hydrate(
ReactDOM.hydrateRoot(
rootElement,
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<GlobalStyle />
Expand All @@ -45,7 +45,6 @@ if (rootElement?.hasChildNodes()) {
</ThemeProvider>
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>,
rootElement,
);
} else {
ReactDOM.createRoot(document.getElementById("root")!).render(
Expand Down

0 comments on commit 236245b

Please sign in to comment.