Skip to content

Commit

Permalink
Only warn in case the fourth argument is a function (#16543)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Scopelliti authored and gaearon committed Aug 22, 2019
1 parent 05f5192 commit 16c3408
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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().',
Expand Down

0 comments on commit 16c3408

Please sign in to comment.