Question about navbar error #329
|
Hi, when I was finishing my US I found some strange error in navbar component, I think this line was made by @4l3x4nd3r4u1 |
Answered by
4l3x4nd3r4u1
May 20, 2026
Replies: 1 comment 1 reply
1 reply
Answer selected by
AnahiSU
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


I reviewed the Navbar issue you mentioned. The red underline you're seeing could be due to the exhaustive-deps ESLint rule. Although the code works, the linter might warn because the useEffect depends on theme but internally calls setTheme with currentTheme, which could suggest a potential infinite loop (even though the if prevents it). I don't see the error in my editor (Neovim), so this is my best guess based on the snippet you shared.
A possible fix is to set the dependency array to empty [], since this effect should only run once when the component mounts to sync the theme from localStorage. Here's the suggested snippet: