Operations
There are several built-in actions:
- all(action)
- insert(path, value)
- insertAll(path, values)
- pop(path, n)
- push(path, value)
- pushAll(path, values)
- remove(path, n)
- set(path, value)
- shift(path, n)
- unshift(path, value)
- unshiftAll(path, values)
To use those just import ACTIONS
object:
import { ACTIONS } from 'general-reducer';
// or
import { createGeneralReducer } from 'general-reducer';
const { ACTIONS } = createGeneralReducer(...);
...
dispatch(ACTIONS.set(...));
If by some reason you need action type constants, they are available as well:
import { TYPES } from 'general-reducer';
// or
import { createGeneralReducer } from 'general-reducer';
const { TYPES } = createGeneralReducer(...);
...
dispatch({ type: TYPES.set, payload: ... });