useSetState
Manage object type responsive Hooks, supporting deconstructing assignments and facilitating maintenance.
Code demonstration
API
const [state, setState] = useSetState<S extends Record<string, any>>
(initialState: StateType<S>)
:[
[S] extends [Ref<any>] ? S : Ref<UnwrapRef<S>>,
(patch: Record<string, any>) => void
]
const [state, setState] = useSetState<S extends Record<string, any>>
(initialState: StateType<S>)
:[
[S] extends [Ref<any>] ? S : Ref<UnwrapRef<S>>,
(patch: Record<string, any>) => void
]