-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrap-with-provider.tsx
34 lines (29 loc) · 1.06 KB
/
wrap-with-provider.tsx
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
29
30
31
32
33
34
import * as React from "react"
import { ColorModeProvider, ThemeProvider } from "@chakra-ui/react"
import { QueryClient, QueryClientProvider } from "react-query"
import { GlobalsStateProvider } from "./src/state/state"
import theme from "./src/@chakra-ui/gatsby-plugin/theme"
type WrapTypes = {
element: React.ReactNode
}
// Create a client
const queryClient = new QueryClient()
// eslint-disable-next-line react/display-name,react/prop-types
export default ({ element }: WrapTypes): React.ReactElement => {
return (
<>
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<ColorModeProvider
options={{
initialColorMode: "light",
useSystemColorMode: false,
}}
>
<GlobalsStateProvider>{element}</GlobalsStateProvider>
</ColorModeProvider>
</ThemeProvider>
</QueryClientProvider>
</>
)
}