79428213

Date: 2025-02-10 20:24:21
Score: 0.5
Natty:
Report link

I ran into the same issue trying to set my theme with local storage. Based on the article "Flicker-free Dark Theme Toggle", it looks like when using local storage, the page is loaded first before the value in local storage can be acquired and gives a flicker effect. I followed the article and used the next-themes npm and everything works for me. If you don't want to use that npm, then maybe switch over to using a global state (like Redux or Vuex) value to store the toggle value. Save the initial value in browser and set the value in global state and refer to that when rendering

Reasons:
  • Whitelisted phrase (-1): works for me
  • Long answer (-0.5):
  • No code block (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: Ken Feier