Skip to content

useSetState ​

Manage object type responsive Hooks, supporting deconstructing assignments and facilitating maintenance.

Code demonstration ​

API ​

typescript
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
 ]

Source ​

Source · Document · Demo

Released under the MIT License.