rsnext/examples/with-redux/pages/other.js
Kirill Konshin f0cb5b71a0 Added next-redux-wrapper to example (#1196)
* Added next-redux-wrapper to example

* Docs, renamed withRedux
2017-02-18 01:10:27 -03:00

27 lines
No EOL
630 B
JavaScript

import React from 'react'
import { reducer, initStore, startClock } from '../store'
import withRedux from 'next-redux-wrapper';
import Page from '../components/Page'
class Counter extends React.Component {
static getInitialProps ({ store, isServer }) {
store.dispatch({ type: 'TICK', light: !isServer, ts: Date.now() })
return { isServer }
}
componentDidMount () {
this.timer = this.props.dispatch(startClock())
}
componentWillUnmount () {
clearInterval(this.timer)
}
render () {
return (
<Page title='Other Page' linkTo='/' />
)
}
}
export default withRedux(initStore)(Counter)