File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,13 @@ export function useUncontrolled<T, E extends HTMLInputElement | HTMLSelectElemen
12
12
13
13
// Although the `transformValue` is most likely not stable, still wraps it with `useCallback` in case the
14
14
// user does memoize it and we are able to opt-in useReducer's internal optimization.
15
- const reducer = useCallback ( ( _prevState : T , valueAsAction : T ) => {
15
+ //
16
+ // **UPDATE**
17
+ // React removes the eager reducer bailout since React 18, so memoize the reducer is no longer necessary.
18
+ // https://github.com/facebook/react/pull/22445
19
+ const reducer = ( _prevState : T , valueAsAction : T ) => {
16
20
return transformValue ( valueAsAction ) ;
17
- } , [ transformValue ] ) ;
21
+ } ;
18
22
19
23
const [ uncontrolledValue , setUncontrolledValue ] = useReducer ( reducer , initialValue ) ;
20
24
You can’t perform that action at this time.
0 commit comments