react-redux-optimist
react bindings for redux-optimist
let o = thiscontext; // optimistically update with an action// -> {type: 'add_to', payload, optimist: {}, ...} // after some async stuff, dispatch a commit// -> {type: 'add_to:commit', payload, optimist: {}, ...} // or if you you want to revert the optimistic update// -> {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 offcontext
-
dispatch!
-
from the work on redux-react-local