const useCursor: <T>(
pair: Pair<T>,
defaults?: NonNullable<T>,
) => Cursor<T>
Make a cursor from a [value, updater]
pair, as returned by useUpdateState
.
cursor.foo.bar
to get a new cursor.cursor.foo.bar()
to get a new getter/updater pair.If defaults
are supplied, the cursor will merge them in.
When the first update is made, it will dispatch a $set
operation first
to permanently insert them, and allow a clean patch to be made.
packages / state / src / hooks-live.ts