redux-trivial-actions utility library by Brainbean Apps
Objectified Flux Standard Action for Redux.
$ npm install --save redux-trivial-actions
or
$ yarn add redux-trivial-actions
import { createTrivialAction } from 'redux-trivial-actions'
export const demoAction = createTrivialAction('DEMO_ACTION')
import { demoAction } from './actions'
const initialState = { demoValue: false }
const reducer = (state = initialState, action) => {
switch (action.type) {
case demoAction.PERFORM:
return { ...state, demoValue: true }
default:
return state
}
}
export default reducer;
import { demoAction } from './actions'
// ...
dispatch(demoAction.perform())
// or
dispatch(demoAction())
// ...