-
Notifications
You must be signed in to change notification settings - Fork 49.3k
Closed
Closed
Copy link
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug
Description
React version: 18
Steps To Reproduce
https://codesandbox.io/s/blissful-margulis-gljgjm?file=/src/App.js
import { useEffect } from 'react';
export default () => {
const isVal = 0;
if (isVal) {
// NO HOOK WARNING
useEffect(() => {
//
});
}
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
</div>
);
}
import { useEffect } from 'react';
export default function App() {
const isVal = 0;
if (isVal) {
// SHOWS HOOK WARNING
useEffect(() => {
//
});
}
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
</div>
);
}
The current behavior
Conditional hook usage isn't detected inside export default () => { ... }
The expected behavior
Conditional hook usage should be detected inside export default () => { ... }
Cside and honzzyk
Metadata
Metadata
Assignees
Labels
Status: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug