mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
dev warnings as console.warn
This commit is contained in:
parent
b117a306e6
commit
33b22a718c
@ -6,14 +6,14 @@ const isPrimitive = (val: any) => val !== Object(val)
|
||||
const useDeepCompareEffect = (effect: EffectCallback, deps: any[]) => {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!deps || !deps.length) {
|
||||
throw new Error(
|
||||
'useDeepCompareEffect should not be used with no dependencies. Use React.useEffect instead.',
|
||||
)
|
||||
console.warn(
|
||||
'`useDeepCompareEffect` should not be used with no dependencies. Use React.useEffect instead.'
|
||||
);
|
||||
}
|
||||
|
||||
if (deps.every(isPrimitive)) {
|
||||
throw new Error(
|
||||
'useDeepCompareEffect should not be used with dependencies that are all primitive values. Use React.useEffect instead.',
|
||||
console.warn(
|
||||
'`useDeepCompareEffect` should not be used with dependencies that are all primitive values. Use React.useEffect instead.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user