Skip to content

Commit

Permalink
fix: useControllableValue 当props为null时代码兼容(#2630)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmml-zhao committed Sep 2, 2024
1 parent eb700b9 commit 33b4d5e
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 33b4d5e

Please sign in to comment.