1.0.3 • Published 8 years ago

react-redux-optimist v1.0.3

Weekly downloads
1
License
ISC
Repository
-
Last release
8 years ago

react-redux-optimist

react bindings for redux-optimist

halffull

let o = this.context.optimist('add_todo');

// optimistically update with an action
dispatch(o.begin({payload, ...}))
// -> {type: 'add_to', payload, optimist: {}, ...}

// after some async stuff, dispatch a commit
dispatch(o.commit({payload, ...}))
// -> {type: 'add_to:commit', payload, optimist: {}, ...}

// or if you you want to revert the optimistic update
dispatch(o.revert({payload, error, ...}))
// -> {type: 'add_to:revert', payload, error, optimist: {}, ...}

// you could override the generated action types, of course.

getting started

  • integrate redux-optimist into your redux stack
  • put the <Optimist> tag high up in your react tree
  • read the optimist helper function off context
  • dispatch!
1.0.3

8 years ago

1.0.0

8 years ago