Skip to main contentredux-mvc

UseModel

Consumes state from the context and wrapps actionCreators in the context’s dispatch.

The main difference with the connect Hoc is that it would not apply the instanceId into the context, nor the renderLevel that ensures the parents of a component render first.

E.g.:

import { useModel } from "@redux-mvc/core"
const Component = () => {
const { count, add } = useModel({
count: getters.count,
}, {
add: actions.add,
add: actions.reset
}, {