-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-browser.js
33 lines (29 loc) · 982 Bytes
/
gatsby-browser.js
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
import React from "react"
import { Provider } from "react-redux"
import { PersistGate } from "redux-persist/integration/react"
import { ThemeProvider } from 'styled-components';
import { Helmet } from "react-helmet";
import GlobalStyle from './src/lib/global-styles';
import configureStore from "./src/redux/configure-store"
import { theme } from './src/lib/constants';
import LoadingPage from "./src/components/Layout/LoadingPage"
const { store, persistor } = configureStore()
/* eslint-disable react/prop-types */
export const wrapRootElement = ({ element }) => (
<Provider store={store}>
<PersistGate loading={<LoadingPage />} persistor={persistor}>
{element}
</PersistGate>
</Provider>
);
export const wrapPageElement = ({ element }) => (
<ThemeProvider theme={theme}>
<>
<Helmet>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</Helmet>
<GlobalStyle />
{element}
</>
</ThemeProvider>
);