2018-05-08 12:57:41 +00:00
|
|
|
import React from 'react'
|
2018-12-17 16:34:32 +00:00
|
|
|
import { Provider } from 'react-redux'
|
|
|
|
import App, { Container } from 'next/app'
|
2018-05-08 12:57:41 +00:00
|
|
|
import withRedux from 'next-redux-wrapper'
|
2018-12-17 16:34:32 +00:00
|
|
|
import { initStore } from '../store'
|
2018-05-08 12:57:41 +00:00
|
|
|
|
2018-12-17 16:34:32 +00:00
|
|
|
export default withRedux(initStore)(
|
|
|
|
class MyApp extends App {
|
|
|
|
static async getInitialProps ({ Component, ctx }) {
|
|
|
|
return {
|
|
|
|
pageProps: Component.getInitialProps
|
|
|
|
? await Component.getInitialProps(ctx)
|
|
|
|
: {}
|
|
|
|
}
|
2018-05-08 12:57:41 +00:00
|
|
|
}
|
|
|
|
|
2018-12-17 16:34:32 +00:00
|
|
|
render () {
|
|
|
|
const { Component, pageProps, store } = this.props
|
|
|
|
return (
|
|
|
|
<Container>
|
|
|
|
<Provider store={store}>
|
|
|
|
<Component {...pageProps} />
|
|
|
|
</Provider>
|
|
|
|
</Container>
|
|
|
|
)
|
|
|
|
}
|
2018-05-08 12:57:41 +00:00
|
|
|
}
|
2018-12-17 16:34:32 +00:00
|
|
|
)
|