All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to [Semantic Versioning(http://semver.org/spec/v2.0.0.html).
- much improved TS typings, now with dispatch autocomplete
- improved TS typings
- use store names in redux devtools
- plugin API has changed to avoid using
init. Shared dependencies are accessed withthis. See the plugins API - as a result of plugin API changes, v1.0.0-alpha.0 requires updating all plugins
- imported global
dispatchnow fires into all stores - imported global
getStatenow gets state from all stores. Note:init({ name })will be used as the store.name, otherwise it defaults to the index.
Effects now dispatch actions that can be seen in the devtools.
Support for devtool action creators. See #281.
- listen to actions from other models within your reducers
const count2 = {
state: 0,
reducers: {
// listens for action from other reducer
'count1/increment': (state) => state + 1
}
}Note: not yet available for effects.
getStatefrom core in 0.4.0 will be altered with v1.0.0.
- export
getStatefrom core. See example below:
import { getState } from '@rematch/core'
const state = getState()- dispatch meta parameter - an optional second dispatch param that can be used to pass "meta" information
dispatch.example.update(payload, { syncWithServer: true })
// is equal to:
// dispatch({ type: 'example/update', payload, meta: { syncWithServer} })Meta can be accessed as the third param from reducers and effects.
const model = {
state: 0,
reducers: {
someReducer: (state, payload, meta) {
// see meta as third param
}
}
}- a dispatch will return a value as a Promise
- Overwrite store.dispatch with rematch dispatch. No more need for importing dispatch when using "react-redux".