east Function – makeCursor

const makeCursor: <T>(
  pair: Pair<T>,
  defaults?: NonNullable<T>,
  keep?: CursorMap<T>,
) => [Cursor<T>, CursorMap<T>]

Make a Cursor<T> from a [value, updater] pair.

  • Also returns mutable CursorMap of cached cursors. This is filled in whenever cursor.foo.… is accessed.
  • When creating a replacement cursor for a changed value, pass the map as keep to preserve child cursors for unchanged parts.
  • This will compare the old and new value for each key in keep.

See makeUseCursor.

Source

packages / state / src / cursor.ts

Sections
Source  
menu
format_list_numbered