react-redux-optimist

1.0.3 • Public • Published

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!

  • from the work on redux-react-local

Readme

Keywords

none

Package Sidebar

Install

npm i react-redux-optimist

Weekly Downloads

0

Version

1.0.3

License

ISC

Last publish

Collaborators

  • threepointone