phishing Hook – useUpdateState

const useUpdateState: <T>(
  initialState: Initial<T>,
  useStateHook?: UseState,
) => Pair<T>

useState with an updateState instead of a setState. Uses patch to apply updates.

const [state, updateState] = useUpdateState({ ... });

When combined with useCursor, this allows for zero-hassle state management.

Compose this hook with other useState variants using useStateHook, e.g. the classic useLocalStorage that saves to browser local storage.

Source

packages / state / src / hooks-live.ts

Sections
Source  
menu
format_list_numbered