//If condition must be after useEffet()
// error
const C = () => {
if (condition) return null;
useEffect(() => {/*...*/}, []);
return <div></div>
}
//no error
const C = () => {
useEffect(() => {/*...*/}, []);
if (condition) return null;
return <div></div>
}