https://github.com/dkemper01/react-context-binary-theme-starter
A React 18 app which uses Context for theme switching.
https://github.com/dkemper01/react-context-binary-theme-starter
Last synced: 2 months ago
JSON representation
A React 18 app which uses Context for theme switching.
- Host: GitHub
- URL: https://github.com/dkemper01/react-context-binary-theme-starter
- Owner: dkemper01
- Created: 2023-01-02T23:33:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-08T15:37:49.000Z (over 2 years ago)
- Last Synced: 2025-01-20T17:49:13.213Z (4 months ago)
- Language: JavaScript
- Size: 762 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Context: Binary Theme Starter
[Demo](https://d3csj2qyo9e6ux.cloudfront.net/)
This repository is a small React 18 app, originally cloned from https://github.com/zolomohan/react-context-dark-mode. It uses a single `Context` object called ThemeContext, for exposing a `darkMode` flag to all components in the component tree.
What differentiates this from the originally cloned repo is
- An upgrade to React 18
- The approach for toggling the light or dark (binary), which uses the ternary conditional only at the top level of the component tree. CSS is leveraged to perform the rest of the work.
- Use of CSS transitions for natural color shiftingTo clone the repository, run
```bash
git clone https://github.com/dkemper01/react-context-binary-theme-starter.git
```To install the dependencies, run
```bash
npm install
```Once you've installed the dependencies, it's time to run the application. with,
```bash
npm start
```This will start the application in port 3000. Visit [localhost:3000](https://localhost:3000) from your browser to view the application.