# useSetState A state hook that simplifies managing state objects by merging updates into the current state instead of replacing it. This hook is especially useful for managing complex or deeply nested state structures without manually merging updates. > It automatically merges updates into the current state instead of replacing it, mimicking the behavior of this.setState in React class components. ## Usage ```tsx import { useSetState } from '@gilbarbara/hooks'; function Component() { const [state, setState] = useSetState({ count: 0, gretting: 'hey' }); return (
{JSON.stringify(state, null, 2)}
); } ``` ## Reference ```typescript useSetState>( initialState: T = {} as T, ): [T, (patch: Patch) => void] ```