Releases: ncking/react-simple-store
Releases · ncking/react-simple-store
2.0.2
2.0.0
Breaking Changes
The createStore function argument list has changed to
the parameter object pattern.
It has the same arguments, just wrapped in an object.
Why
The argument list will be expanding, with flags & functions for new features.
Making the change now, will future proof v2 code, when these changes are implemented.
Change
- export const createStore = (
- actions: ActionsCreator,
- initialState: State = {}
- ) => {
+ export const createStore: CreateStoreApi = ({
+ actions = () => ({}),
+ state: initialState = {},
+ } = {}) => {
Migrating to v2
You just need to change the arguments list on calls to createStore(),
to be a single object
// from
const myStore = createStore(actions, state)
// to
const myStore = createStore({actions, state})