phishing Hook – useCursor

const useCursor: <T>(
  pair: Pair<T>,
  defaults?: NonNullable<T>,
) => Cursor<T>

Make a cursor from a [value, updater] pair, as returned by useUpdateState.

  • Traverse cursor.foo.bar to get a new cursor.
  • Call 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.

Source

packages / state / src / hooks-live.ts

Sections
Source  
menu
format_list_numbered