By default, the export package name for all APIs in this section is: @modern-js/runtime/model
.
If Reduck is integrated separately from Modern.js, the export package name is: @modern-js-reduck/react
.
The original type of Reduck is complex. The following type definition shows the simplified type information. For the original type, see model.
useModel
return value array.useModel
return value array.Returns an array with each value:
stateSelector
. if there is no stateSelector
, will combine all incoming Model States(including derived states) and return them. If there is an attribute of the same name in the State of different Models, the following State will override the previous State. when state
changes, the component call useModel
will re-render.actionSelector
. if there is no actionSelector
, will combine all incoming Model Action(including Effect) and return them. If there is an attribute of the same name in the Action of different Models, the following Action will override the previous Action.