@knitui/hooks
useSetState
Object state with shallow partial merge — port of Mantine's useSetState. setState({ a }) merges a into the current state (class-component setState semantics). Pure React, so identical on web and native.
WebiOSAndroid
Import
import { useSetState } from "@knitui/hooks";Signature
export function useSetState<T extends Record<string, unknown>>( initialState: T, ): [T, (statePartial: Partial<T> | SetStateCallback<T>) => void]Exported types: SetStateCallback