-
Notifications
You must be signed in to change notification settings - Fork 50.2k
Closed
Labels
Resolution: StaleAutomatically closed due to inactivityAutomatically closed due to inactivityType: Enhancement
Description
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
Suppose you give an undefined object or forget to provide parameters to useEffect:
const App = () => {
React.useEffect();
return "";
};
ReactDOM.render(<App />, document.getElementById('container'));On JSFiddle (https://jsfiddle.net/g39javzq), this error stack is logged:
Uncaught TypeError: create is not a function
at commitHookEffectList (react-dom.development.js:17372)
at commitPassiveHookEffects (react-dom.development.js:17396)
at HTMLUnknownElement.callCallback (react-dom.development.js:143)
at Object.invokeGuardedCallbackDev (react-dom.development.js:193)
at invokeGuardedCallback (react-dom.development.js:250)
at commitPassiveEffects (react-dom.development.js:18863)
at wrapped (react.development.js:1353)
at flushFirstCallback (react.development.js:587)
at flushWork (react.development.js:699)
at MessagePort.channel.port1.onmessage (react.development.js:1093)
...though on a local project in React 16.8.4, this stack is logged:
Uncaught TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
at _iterableToArrayLimit (my-project.chunk.js:123)
at _slicedToArray (my-project.chunk.js:456)
at MyComponent (myFile.js:7)
What is the expected behavior?
Neither of these were useful during the 5 minutes it took to find the culprit useEffect that should have been a useState.
In development, we check for an undefined deps argument in useEffect and give a better warning?
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React 16.8.4, Chrome on Mac.
art-in, erikfenriz and Solify-Finance
Metadata
Metadata
Assignees
Labels
Resolution: StaleAutomatically closed due to inactivityAutomatically closed due to inactivityType: Enhancement