在这里注入 system
import{Provider}from"ractor-hooks"import{System}from"ractor"functionApp(){return<Providersystem={newSystem("app")}><Counter/></Provider>}输入 Ractor Store 的子类作为参数,输出实例化之后的状态。
functionCounter(){constcounter=useStore(CounterStore)returnjsx}输出 Provider 注入的 system。建议直接倒入 system,不太建议使用这种方式获取 system。
functionCounter(){constsystem=useSystem(CounterStore)system.dispatch(newIncrement)returnjsx}