forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating with-redux-saga example (vercel#4356)
- Loading branch information
1 parent
ac55eef
commit 623b34d
Showing
5 changed files
with
54 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import App, { Container } from 'next/app' | ||
import React from 'react' | ||
import { Provider } from 'react-redux' | ||
import withRedux from 'next-redux-wrapper' | ||
import createStore from '../store' | ||
import withReduxSaga from 'next-redux-saga' | ||
|
||
class MyApp extends App { | ||
static async getInitialProps ({ Component, ctx }) { | ||
let pageProps = {} | ||
|
||
if (Component.getInitialProps) { | ||
pageProps = await Component.getInitialProps({ ctx }) | ||
} | ||
|
||
return { pageProps } | ||
} | ||
|
||
render () { | ||
const { Component, pageProps, store } = this.props | ||
return ( | ||
<Container> | ||
<Provider store={store}> | ||
<Component {...pageProps} /> | ||
</Provider> | ||
</Container> | ||
) | ||
} | ||
} | ||
|
||
export default withRedux(createStore)(withReduxSaga({ async: true })(MyApp)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters