2017-07-13 18:55:29 +00:00
|
|
|
import React from 'react'
|
2018-05-13 16:26:17 +00:00
|
|
|
import {connect} from 'react-redux'
|
2018-02-11 18:55:16 +00:00
|
|
|
import {increment, startClock, tickClock} from '../actions'
|
2017-07-13 18:55:29 +00:00
|
|
|
import Page from '../components/page'
|
|
|
|
|
|
|
|
class Counter extends React.Component {
|
2018-05-13 16:26:17 +00:00
|
|
|
static async getInitialProps (props) {
|
|
|
|
const { store, isServer } = props.ctx
|
2018-02-11 18:55:16 +00:00
|
|
|
store.dispatch(tickClock(isServer))
|
2017-07-13 18:55:29 +00:00
|
|
|
store.dispatch(increment())
|
2018-05-13 16:26:17 +00:00
|
|
|
return { isServer }
|
2017-07-13 18:55:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount () {
|
|
|
|
this.props.dispatch(startClock())
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
return <Page title='Other Page' linkTo='/' />
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-13 16:26:17 +00:00
|
|
|
export default connect()(Counter)
|