page/index.js
export const getStaticProps = wrapper.getStaticProps(async ({ store }) => {
store.dispatch(serverRenderClock(true))
store.dispatch(addCount())
})
the reducer.js
import { countActionTypes } from './action'
const countInitialState = {
count: 0,
}
export default function reducer(state = countInitialState, action) {
switch (action.type) {
case countActionTypes.ADD:
return Object.assign({}, state, {
count: state.count + 1,
})
default:
return state
}
}
按理说 store.dispatch(addCount())
执行了这段代码发起了redux请求,那么count应该加了1,为什么页面显示还是0呢?