Only warn in case the fourth argument is a function (#16543)
Bruno Scopelliti committed
Aug 22, 2019 at 18:31 UTC
16c34086380fc4e4ff20fca1ed27e9e35bd98299
1 file changed
+1
-1
packages/react-reconciler/src/ReactFiberHooks.js
+1
-1
@@ -1122,7 +1122,7 @@ function dispatchAction<S, A>(
1122
1123
if (__DEV__) {
1124
warning(
1125
- arguments.length <= 3,
1125
+ typeof arguments[3] !== 'function',
1126
"State updates from the useState() and useReducer() Hooks don't support the " +
1127
'second callback argument. To execute a side effect after ' +
1128
'rendering, declare it in the component body with useEffect().',