195 // Theme toggle function
196 const handleThemeChange = () => {
197 toggleTheme();
198 setTheme((prevTheme) => (prevTheme === "light" ? "dark" : "light"));199 };
200
201 return (
146 // Theme toggle function
147 const handleThemeChange = () => {
148 toggleTheme();
149 setTheme((prevTheme) => (prevTheme === "light" ? "dark" : "light"));150 };
151
152 return (
14 if (!validEmail(event.target.value)) {
15 setError("**Enter a valid E-mail!");
16 } else {
17 setError("");18 }
19}
20function ForgotPassword() {
12function onChangeEvent(event){
13 setEmail(event.target.value)
14 if (!validEmail(event.target.value)) {
15 setError("**Enter a valid E-mail!");16 } else {
17 setError("");
18 }
10 return re.test(email);
11}
12function onChangeEvent(event){
13 setEmail(event.target.value)14 if (!validEmail(event.target.value)) {
15 setError("**Enter a valid E-mail!");
16 } else {
59 // Theme toggle function
60 const handleThemeChange = () => {
61 toggleTheme();
62 setTheme((prevTheme) => (prevTheme === "light" ? "dark" : "light")); 63 };
64
65 return (
10 if (user) {
11 console.log("");
12 } else if (!user) {
13 navigate("/");14 }
15 });
16 }, []);
Variables that aren't defined, but accessed may throw reference errors at runtime.
NOTE: In browser applications, DeepSource recommends the use of ESModules over regular
text/javascript
scripts. Using variables that are injected by scripts included in an HTML file is currently not supported.
Potential ReferenceError
s may result from misspellings of variable and parameter names, or accidental implicit globals (for example, forgetting the var
keyword in a for
loop initializer).
Any reference to an undeclared variable causes a warning, unless the variable is explicitly mentioned in a /*global ...*/
comment, or specified in the globals key in the configuration file.
A common use case for these is if you intentionally use globals that are defined elsewhere (e.g. in a script sourced from HTML).
Bad Practice
const foo = someFunction(); // `someFunction` is not defined
const bar = baz + 1; // 'baz' is undeclared
Recommended
import { someFunction } from 'some-file';
const baz = Math.random();
const foo = someFunction();
const bar = baz + 1;