preact-scoped-model
provides a set of functions which produces Preact-based hooks based on the out-of-the-box hooks. These functions accepts the same set of parameters as their hook counterparts.
createValue
: creates a hook based on useValue.
import { createValue } from 'preact-scoped-model';
const useTimer = createValue(Timer);
// ...
const { seconds } = useTimer();
createSelector
: creates a hook based on useSelector.
import { createSelector } from 'preact-scoped-model';
const useTimerSeconds = createSelector(Timer, (state) => state.seconds);
// ...
const seconds = useTimerSeconds();
createSelectors
: creates a hook based on useSelectors.createValueOnce
: creates a hook based on useValueOnce`.createSelectorOnce
: creates a hook based on useValueOnce`.createSnapshot
: creates a hook based on useSnapshot`.