Skip to content

v1.1.0

Compare
Choose a tag to compare
@alvinhui alvinhui released this 05 Mar 12:11
· 34 commits to master since this release
cc5c015
  • Added effects && reducers to define model;
  • Added more documents: Upgrade Guidelines.

Change log

It is no longer recommended to use actions to define model, please use reducers && effects. #66

1.0.0:

const model = {
  state: 0,
  actions: {
    increment:(prevState) => prevState + 1,
    async decrementAsync(prevState, payload, actions) {
      await delay(1000);
      return prevState - 1;
    },
  },
};

1.1.0:

const model = {
  state: 0,
  reducers: {
    increment:(prevState) => prevState + 1,
    decrement:(prevState) => prevState - 1,
  },
  effects: {
    async decrementAsync(state, payload, actions) {
      await delay(1000);
      actions.decrement();
    },
  },
};