vigetlabs / microcosm

Flux with actions at center stage. Write optimistic updates, cancel requests, and track changes with ease.
http://code.viget.com/microcosm/
MIT License
487 stars 29 forks source link

Fix ActionForm example #442

Closed nhunzaker closed 6 years ago

nhunzaker commented 6 years ago

http://code.viget.com/microcosm/api/action-form.html

repo.addDomain('count', {
  getInitialState () {
    return 0
  },
  increase (count, amount) {
    return count + amount
  },
  register () {
    return {
      [increaseCount] : this.increase
    }
  }
})

The payload is wrong in increase. It should be:

repo.addDomain('count', {
  getInitialState () {
    return 0
  },
  increase (count, { amount }) {
    return count + amount
  },
  register () {
    return {
      [increaseCount] : this.increase
    }
  }
})