React
Installation
npm i awai-react
This library provides hooks for connecting Awai's state nodes with React components.
useSetState- returns astate.setmethod (can be used directly).useStateValue- returns curent state value. It works with suspense and ensures that async node is loaded.useState- Returns a tuple[useStateValue(state), useSetState(state)], just to be aligned with React'suseStateinterface.useAsyncStateValue- this hook only works withReadableAsyncState(eg. AsyncState) and returns a result ofgetAsyncmethod. UnlikeuseStateValuethis hook does not suspend. That means that component is rendered even though state is not yet initialized, which results invalueto be possiblyundefined.