We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src/redux/reducers/counter.js
import {INCREMENT, DECREMENT, RESET} from '../actions/counter'; const initState = { count: 0 }; export default function reducer(state = initState, action) { switch (action.type) { case INCREMENT: return { count: state.count + 1 }; case DECREMENT: return { count: state.count - 1 }; case RESET: return {count: 0}; //这里是不是应该是 return 0 default: return state } }
如果reset返回的不是0而是一个对象,console的结果会是 { counter: { count: 0 } } { counter: { count: 1 } } { counter: { count: 0 } } { counter: { count: { count: 0 } } }
webpack testRedux.js build.js 这里我这么写会报错,最后用的是 webpack testRedux.js -o build.js 是不是因为我用的webpack版本是4.16.5?所以不一样
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
No branches or pull requests
src/redux/reducers/counter.js
如果reset返回的不是0而是一个对象,console的结果会是
{ counter: { count: 0 } }
{ counter: { count: 1 } }
{ counter: { count: 0 } }
{ counter: { count: { count: 0 } } }
webpack testRedux.js build.js
这里我这么写会报错,最后用的是 webpack testRedux.js -o build.js
是不是因为我用的webpack版本是4.16.5?所以不一样
The text was updated successfully, but these errors were encountered: