This mini-project is a study in React Event Handling.
The goal was to build a simple, responsive interface that allows users to dynamically manipulate the DOM (Document Object Model) properties—specifically the background color—in real-time using React state variables, rather than direct DOM manipulation.
- Dynamic Color Palette: A selection of curated colors (Red, Green, Blue, Olive, Gray, etc.) presented as a button bar.
- Instant State Update: The background changes immediately upon user interaction without page reloads.
- Tailwind Styling: Buttons are styled for distinct visibility and hover effects using utility classes.
Despite its simplicity, this project reinforced core React concepts:
- State Management (
useState): How to hold the current color value in memory. - Event Listeners: Attaching
onClickhandlers to buttons to trigger state changes. - Inline Styling vs. Classes: Passing the state variable directly to the style property of the main container to effect the change.
- Library: React.js
- Styling: Tailwind CSS
- Clone the repository:
git clone https://github.com/tsdebug/react-bg-changer
- Install dependencies:
npm install
- Start the app:
npm run dev
A simple experiment in interactivity.