v3.0.0
- feat(model): support user to expand actions' context
- fix(actions): fix the error types and key
install:
npm i --save react-model
Breaking changes 💥: NextModelType => ModelType
old.ts
const model = {
state: { key: value },
actions: {
setState: (state, actions, payload) => {
return { key: payload }
}
}
}
export default model
Now
import { Model } from 'react-model'
const model = {
state: { key: value },
actions: {
setState: (payload, { state, actions }) => {
return { key: payload }
}
}
}
export default Model(model)
// or export default model
Advance: https://www.npmjs.com/package/react-model/v/3.0.0#expand-context