You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use the newest version of create-react-app, but I don't get any errors / warnings when I use a variable or function in a useEffect hook and don't add them to the dependency list.
import { FC, useEffect, useState } from "react";
import Modal from "./lib/modal";
const App: FC = () => {
const [showModal, setShowModal] = useState(false);
const handleClose = () => {
if (showModal) {
setShowModal(false);
}
};
useEffect(() => {
/* Don't get any warning for 'showModal' */
if (showModal) {
console.log("es lint test");
}
}, []);
return (
<>
<button onClick={() => setShowModal(true)}>Open Modal</button>
<Modal show={showModal} onClose={handleClose} />
</>
);
};
export default App;
The text was updated successfully, but these errors were encountered:
I use the newest version of create-react-app, but I don't get any errors / warnings when I use a variable or function in a useEffect hook and don't add them to the dependency list.
The text was updated successfully, but these errors were encountered: