Skip to content
Discussion options

You must be logged in to vote

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:

useEffect(() => {
  const savedTheme = window.localStorage.getItem

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@AnahiSU
Comment options

AnahiSU May 21, 2026
Collaborator Author

Answer selected by AnahiSU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants