rrethunk
helpers for redux which reduces boilerplate code
Actions
// actions const clear = { return } // it will resolve this promise// and trigger fetchData:busy while primise is loading// and fetchData:success when promise is resolvedconst fetchData = { return } const actions = /** * => {type: '@data/fetchData:loading', payload: { entity: 'todo', info: 'bla lba' }', meta: { entity: 'todo' } } * => {type: '@data/fetchData:success', payload: {//thunk result}, meta: { entity: 'todo' } } * or => {type: '@data/fetchData:error', payload: {//error result}, meta: { entity: 'todo' } } * or => {type: '@data/fetchData:canceled', payload: null, meta: { entity: 'todo' } } * */actionsfetchData // => {type: '@data/fetchData:error', payload: 'something happened' }actionsfetchData // => {type: '@data/fetchData:error', payload: 'something happened', meta: { user: 21 } } // reducer const reducer =
how to use
- add redux-thunk middleware
- just use it as plain actions
also there is actionState reducer which store state of each action