Value
Simple value that can be hooked into React.
Source code is hosted on GitHub
yarn add @corets/valuenpm install --save @corets/valueSeamless React integration is shipped in a separate package:
useValueThese packages provide extended functionality and are built on top of this library:
StoreListLocal Storage ValueLocal Storage StoreLocal Storage ListcreateValue()
Create a new observable value:
import { createValue } from "@corets/value"
const count = createValue(0)Create a new observable value without the factory function:
import { Value } from "@corets/value"
const value = new Value(0)Create a new observable value with a custom differ:
Value.get()
Get current value:
Value.set()
Update current value:
Value.listen()
Listen to value changes:
Invoke listener immediately:
Listen with a custom differ:
Value.use()
Convenience method for people used to React's useState syntax:
Last updated
Was this helpful?