Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 432 Bytes

no-duplicate-on.md

File metadata and controls

16 lines (12 loc) · 432 Bytes

effector/no-duplicate-on

Disallows duplcates on-handlers on particular store.

const increment = createEvent();

// 👍 all explicitly
const $goodCounter = createStore(0).on(increment, (counter) => counter + 1);

// 👎 so, which handler should we choose?
// it's better to remove one of them
const $badCounter = createStore(0)
  .on(increment, (counter) => counter + 1)
  .on(increment, (counter) => counter + 2);