Only warn in case the fourth argument is a function (#16543)

This commit is contained in:
Bruno Scopelliti
2019-08-22 18:31:27 +02:00
committed by Dan Abramov
parent 05f5192e81
commit 16c3408638

View File

@@ -1122,7 +1122,7 @@ function dispatchAction<S, A>(
if (__DEV__) {
warning(
arguments.length <= 3,
typeof arguments[3] !== 'function',
"State updates from the useState() and useReducer() Hooks don't support the " +
'second callback argument. To execute a side effect after ' +
'rendering, declare it in the component body with useEffect().',