1.0.6 • Published 5 years ago

ractor-hooks v1.0.6

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

Ractor-hooks

Provider

在这里注入 system

  import { Provider } from "ractor-hooks"
  import { System } from "ractor"

  function App() {
    return <Provider system={new System("app")}><Counter /></Provider>
  }

useStore

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

function Counter() {
  const counter = useStore(CounterStore)
  return jsx
}

useSystem

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

function Counter() {
  const system = useSystem(CounterStore)
  system.dispatch(new Increment)
  return jsx
}
1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago