Library to reduce common tasks for React apps based on re-ducks (https://github.com/alexnm/re-ducks)
import { types } from 're-ducks'
export default types(['create', 'update', 'remove' ])
// > { create: 'create', update: 'update', remove: 'remove'}
import { types } from 're-ducks'
export default types('app/users', [
'create',
'update',
'remove',
])
// > { create: 'app/users/create', update, 'app/users/update', ... }
import { actions } from 're-ducks'
import types from './types'
export default actions(types, [
['create'],
['update'],
['remove'],
])
// > {
// > create: (value) => { type: 'create' },
// > update: (value) => { type: 'update' },
// > remove: (value) => { type: 'remove' },
// > }
import { actions } from 're-ducks'
import types from './types'
export default actions(types, [
['create', 'user'],
['update', 'user'],
['remove', 'user'],
])
// > {
// > create: (value) => { type: 'create', payload: { user: value } },
// > update: (value) => { type: 'update', payload: { user: value } },
// > remove: (value) => { type: 'remove', payload: { user: value } },
// > }