react-native-navigation的迁移库

reducer.js 455B

12345678910111213141516171819202122
  1. import * as types from './actionTypes';
  2. import Immutable from 'seamless-immutable';
  3. const initialState = Immutable({
  4. count: 0
  5. });
  6. export default function counter(state = initialState, action = {}) {
  7. switch (action.type) {
  8. case types.INCREMENT:
  9. return state.merge({
  10. count: state.count + 1
  11. });
  12. case types.DECREMENT:
  13. return state.merge({
  14. count: state.count - 1
  15. });
  16. default:
  17. return state;
  18. }
  19. }