---
title: "Comment by JOY SAM RAJ on \"Add dark mode to your React application with TailwindCSS\" | Hashnode"
description: "I guess change this line const [theme, setTheme] = useState(localStorage.getItem(&#39;theme&#39;)); Because while refreshes it overrides the local storage"
url: "https://hashnode.com/posts/add-dark-mode-to-your-react-application-with-tailwindcss/61041520805a765b08876fc8/comment/62a5a7bba2c282d2d837b29a"
---

[Discussion](https://hashnode.com/posts/add-dark-mode-to-your-react-application-with-tailwindcss/61041520805a765b08876fc8)

Comment [Add dark mode to your React application with TailwindCSS](https://hashnode.com/posts/add-dark-mode-to-your-react-application-with-tailwindcss/61041520805a765b08876fc8)

[JOY SAM RAJ](https://hashnode.com/@JoySam)

[Jun 12, 2022](https://hashnode.com/posts/add-dark-mode-to-your-react-application-with-tailwindcss/61041520805a765b08876fc8/comment/62a5a7bba2c282d2d837b29a)

I guess change this line

`const [theme, setTheme] = useState(localStorage.getItem('theme'));`

Because while refreshes it overrides the local storage
