When integrating Reduck separately from Modern.js, the following modifications need to be made:
Install the Reduck package in the project: @modern-js-reduck/react
.
When used in Modern.js, the package name for exporting Reduck API is: @modern-js/runtime/model
. When using Reduck separately, the package name for exporting is: @modern-js-reduck/react
.
Provider
componentModern.js automatically wraps the Provider
component used to inject the Reduck global Store on the entry component of the application. When using Reduck separately, this needs to be done manually.
Example:
When used in Modern.js, Reduck features can be configured through runtime.state
. When used separately, configuration needs to be done through the config
or store
parameter of Provider
.
Example: