Skip to content

Repository files navigation

Ractor-hooks

Provider

在这里注入 system

import{Provider}from"ractor-hooks"import{System}from"ractor"functionApp(){return<Providersystem={newSystem("app")}><Counter/></Provider>}

useStore

输入 Ractor Store 的子类作为参数,输出实例化之后的状态。

functionCounter(){constcounter=useStore(CounterStore)returnjsx}

useSystem

输出 Provider 注入的 system。建议直接倒入 system,不太建议使用这种方式获取 system。

functionCounter(){constsystem=useSystem(CounterStore)system.dispatch(newIncrement)returnjsx}

About

custom hooks for React

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages