useUncontrolled

Build a component that works controlled and uncontrolled with the same code.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

The same component keeps its own state or follows the value prop.

APIs

useUncontrolled

const useUncontrolled = <T>(options: {
  value?: T
  defaultValue?: T
  finalValue?: T
  onChange?: (value: T) => void
}) => [T, (value: T) => void, boolean]
Edit this page on GitHub