---
id: 2925
title: "Create a Persisting Dark Mode with React"
source_domain: hackerone.com
source_url: "https://www.hackerone.com/blog/create-persisting-dark-mode-react"
published_at: "2020-11-04T00:00:00Z"
tags: ["tutorial", "javascript", "react", "dark-mode", "frontend", "localstorage"]
phying_url: "https://phying.com/item/2925"
lang: en
---

# Create a Persisting Dark Mode with React

## Summary

A React tutorial building a dark/light mode toggle with useState and a data-theme attribute, then persisting the user's choice across reloads via useEffect and localStorage.

## Intelligence Metadata

- **Sources:** hackerone.com
- **Published:** 2020-11-04T00:00:00Z
- **Original:** https://www.hackerone.com/blog/create-persisting-dark-mode-react
- **Phying News:** https://phying.com/item/2925
