Description
uncontrollable is a small React helper for wrapping a controlled component so that chosen prop and handler pairs can be left uncontrolled by the people who use it. The idea is that you write a component with minimal state and let the wrapper manage state only for the props a consumer leaves out. This avoids the boilerplate of tying every input's value to a parent's state, while keeping the flexibility for consumers to control the component when they need to. The package offers two React hooks. useUncontrolledProp takes a value, a default value and an onChange handler, and returns a value and a change handler that are safe to spread onto a child. useUncontrolled takes the props and a hash of prop and handler pairs and returns a complete set of controlled props. The README notes that both can be used in place of the higher-order component form. The README uses a simple dropdown as its example, and it says the React Widgets library makes heavy use of this strategy. The package is for component library authors who want the same two-way behavior as native inputs, where a value can be controlled or left to manage itself.…
Highlights
- Wraps a controlled component so chosen props can be uncontrolled
- useUncontrolledProp and useUncontrolled hooks
- Can be used in place of the higher-order component
- Example of a dropdown that tracks no state
Ratings & Reviews
No ratings yet
Be the first to rate uncontrollable.
People also visit

react-auto-controlled
Component autonomous state control utilities in React class methods
uncontrollable FAQ
What problem does it solve?
It lets a component leave some props uncontrolled, so consumers choose whether to manage state themselves or let the component do it.
What hooks does it provide?
useUncontrolledProp for a single value, and useUncontrolled for a whole set of props and handlers.
Who uses it?
The README says React Widgets makes heavy use of this strategy.
Who is it for?
Component library authors who want native-input-style controlled and uncontrolled behavior.
What are the best uncontrollable alternatives?
Popular alternatives to uncontrollable include react-auto-controlled, react-select and react-quill. See all uncontrollable alternatives



















