Commit 0f2bd192 authored by Corbin Crutchley's avatar Corbin Crutchley Committed by Luis Fernando Alvarez D

with apollo and redux example: Update deps and fix build (#6733)

* with apollo and redux example: Update deps and fix build

* Fix linting errors
parent 1d66da15
......@@ -7,20 +7,20 @@
"start": "next start"
},
"dependencies": {
"apollo-client": "2.2.0",
"apollo-client": "^2.5.1",
"apollo-client-preset": "^1.0.4",
"graphql": "^0.11.7",
"graphql": "^14.1.1",
"graphql-anywhere": "^4.0.2",
"graphql-tag": "^2.5.0",
"isomorphic-unfetch": "^2.0.0",
"isomorphic-unfetch": "^3.0.0",
"next": "latest",
"next-redux-wrapper": "^1.3.5",
"next-redux-wrapper": "^2.1.0",
"prop-types": "^15.6.0",
"react": "^16.7.0",
"react-apollo": "^2.0.1",
"react-dom": "^16.7.0",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-devtools-extension": "^2.13.2",
"redux-thunk": "^2.2.0"
},
......
import App, { Container } from 'next/app'
import React from 'react'
import { Provider } from 'react-redux'
import withRedux from 'next-redux-wrapper'
import { initStore } from '../lib/store'
class MyApp extends App {
static async getInitialProps ({ Component, router, 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(initStore)(MyApp)
import React from 'react'
import { bindActionCreators } from 'redux'
import {
initStore,
startClock,
addCount,
serverRenderClock
} from '../lib/store'
import withRedux from 'next-redux-wrapper'
import { connect } from 'react-redux'
import { startClock, addCount, serverRenderClock } from '../lib/store'
import App from '../components/App'
import Header from '../components/Header'
......@@ -50,4 +45,9 @@ const mapDispatchToProps = dispatch => {
}
}
export default withApollo(withRedux(initStore, null, mapDispatchToProps)(Index))
export default withApollo(
connect(
null,
mapDispatchToProps
)(Index)
)
import React from 'react'
import { bindActionCreators } from 'redux'
import {
initStore,
startClock,
addCount,
serverRenderClock
} from '../lib/store'
import withRedux from 'next-redux-wrapper'
import { connect } from 'react-redux'
import { startClock, addCount, serverRenderClock } from '../lib/store'
import App from '../components/App'
import Header from '../components/Header'
......@@ -45,4 +40,7 @@ const mapDispatchToProps = dispatch => {
}
}
export default withRedux(initStore, null, mapDispatchToProps)(Index)
export default connect(
null,
mapDispatchToProps
)(Index)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment