Skip to content

Commit d4afca3

Browse files
ShaofeiZizishaofei
and
zishaofei
authored
fix: TypeError: props.hasOwnProperty is not a function (#2596)
Co-authored-by: zishaofei <[email protected]>
1 parent b2f1218 commit d4afca3

File tree

1 file changed

+2
-2
lines changed
  • packages/hooks/src/useControllableValue

1 file changed

+2
-2
lines changed

packages/hooks/src/useControllableValue/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ function useControllableValue<T = any>(props: Props = {}, options: Options<T> =
3535
} = options;
3636

3737
const value = props[valuePropName] as T;
38-
const isControlled = props.hasOwnProperty(valuePropName);
38+
const isControlled = Object.prototype.hasOwnProperty.call(props, valuePropName);
3939

4040
const initialValue = useMemo(() => {
4141
if (isControlled) {
4242
return value;
4343
}
44-
if (props.hasOwnProperty(defaultValuePropName)) {
44+
if (Object.prototype.hasOwnProperty.call(props, defaultValuePropName)) {
4545
return props[defaultValuePropName];
4646
}
4747
return defaultValue;

0 commit comments

Comments
 (0)