ffa4089b18
* Update with-redux-thunk example to include HMR * Update README * Fix clock component * Fix example component * Fix README
23 lines
655 B
JavaScript
23 lines
655 B
JavaScript
import * as types from './types'
|
|
|
|
// INITIALIZES CLOCK ON SERVER
|
|
export const serverRenderClock = isServer => dispatch =>
|
|
dispatch({
|
|
type: types.TICK,
|
|
payload: { light: !isServer, ts: Date.now() },
|
|
})
|
|
|
|
// INITIALIZES CLOCK ON CLIENT
|
|
export const startClock = () => dispatch =>
|
|
setInterval(() => {
|
|
dispatch({ type: types.TICK, payload: { light: true, ts: Date.now() } })
|
|
}, 1000)
|
|
|
|
// INCREMENT COUNTER BY 1
|
|
export const incrementCount = () => ({ type: types.INCREMENT })
|
|
|
|
// DECREMENT COUNTER BY 1
|
|
export const decrementCount = () => ({ type: types.DECREMENT })
|
|
|
|
// RESET COUNTER
|
|
export const resetCount = () => ({ type: types.RESET })
|