Skip to content

Commit 5c7281e

Browse files
authored
fix: useControllableValue 当props为null时代码兼容(#2630) (#2636)
1 parent eb700b9 commit 5c7281e

File tree

1 file changed

+3
-1
lines changed
  • packages/hooks/src/useControllableValue

1 file changed

+3
-1
lines changed

packages/hooks/src/useControllableValue/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ function useControllableValue<T = any>(
2626
props?: Props,
2727
options?: Options<T>,
2828
): [T, (v: SetStateAction<T>, ...args: any[]) => void];
29-
function useControllableValue<T = any>(props: Props = {}, options: Options<T> = {}) {
29+
function useControllableValue<T = any>(defaultProps: Props, options: Options<T> = {}) {
30+
const props = defaultProps ?? {};
31+
3032
const {
3133
defaultValue,
3234
defaultValuePropName = 'defaultValue',

0 commit comments

Comments
 (0)