Skip to content

Commit

Permalink
fix: react-query installation (#2255)
Browse files Browse the repository at this point in the history
* fix: react-query installation

* fix review
  • Loading branch information
dunglas committed Sep 14, 2022
1 parent 4285314 commit e6ee1a7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
25 changes: 25 additions & 0 deletions pwa/components/common/Layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ReactNode, useState } from "react";
import {
DehydratedState,
Hydrate,
QueryClient,
QueryClientProvider,
} from "react-query";

const Layout = ({
children,
dehydratedState,
}: {
children: ReactNode;
dehydratedState: DehydratedState;
}) => {
const [queryClient] = useState(() => new QueryClient());

return (
<QueryClientProvider client={queryClient}>
<Hydrate state={dehydratedState}>{children}</Hydrate>
</QueryClientProvider>
);
};

export default Layout;
12 changes: 8 additions & 4 deletions pwa/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import '../styles/globals.css'
import "../styles/globals.css"
import "bootstrap/dist/css/bootstrap.css"
import "bootstrap-icons/font/bootstrap-icons.css"
import type { AppProps } from 'next/app'
import Layout from "../components/common/Layout"
import type { AppProps } from "next/app"
import type { DehydratedState } from "react-query"

function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
function MyApp({ Component, pageProps }: AppProps<{dehydratedState: DehydratedState}>) {
return <Layout dehydratedState={pageProps.dehydratedState}>
<Component {...pageProps} />
</Layout>
}

export default MyApp

0 comments on commit e6ee1a7

Please sign in to comment.