Skip to content

Commit

Permalink
fix: useControllableValue 当props为null时代码兼容(#2630) (#2636)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmml-zhao authored Sep 22, 2024
1 parent eb700b9 commit 5c7281e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/hooks/src/useControllableValue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ function useControllableValue<T = any>(
props?: Props,
options?: Options<T>,
): [T, (v: SetStateAction<T>, ...args: any[]) => void];
function useControllableValue<T = any>(props: Props = {}, options: Options<T> = {}) {
function useControllableValue<T = any>(defaultProps: Props, options: Options<T> = {}) {
const props = defaultProps ?? {};

const {
defaultValue,
defaultValuePropName = 'defaultValue',
Expand Down

0 comments on commit 5c7281e

Please sign in to comment.