easy-peasy icon indicating copy to clipboard operation
easy-peasy copied to clipboard

syntax error in effectOn docs

Open chrtze opened this issue 5 years ago • 0 comments

hi, in the documentation of the new effectOn api the property name in the object is missing:

import { unstable_effectOn } from 'easy-peasy';

const todosModel = {
  items: [],
  saving: false,
  setSaving: action((state, payload) => {
    state.saving = payload;
  }),
  unstable_effectOn(
    // Provide an array of "stateResolvers" to resolve the targeted state:
    [state => state.items],
    // Provide a handler which will execute every time the targeted state changes:
    async (actions, change) => {
      const [items] = change.current;
      actions.setSaving(true);
      await todosService.save(items);
      actions.setSaving(false);
    }
  )
};

should this be changed to something like:

{
onItemsChange: unstable_effectOn(...)
}

https://easy-peasy.now.sh/docs/api/effect-on.html

chrtze avatar Dec 09 '20 11:12 chrtze