A simple React Todo List application demonstrating controlled forms, prop drilling, dynamic list rendering, and support for editing and deleting todo items. The UI is built with Tailwind CSS for a responsive and modern look. It demonstrates core React concepts like:
localStorage
git clone https://github.com/yourusername/react-todo-list.git
cd react-todo-list
Make sure you have Node.js installed, then run:
npm install
If Tailwind CSS isn’t already set up, run the following commands:
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
Then, update the tailwind.config.js
file:
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./src/**/*.{js,jsx,ts,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
And ensure that your src/index.css
contains:
@tailwind base;
@tailwind components;
@tailwind utilities;
To run the app in development mode:
npm start
Then open http://localhost:5173 in your browser.
Adding a Todo:
Type into the input field and click Add Todo to create a new todo item.
Editing a Todo:
Click Edit beside a todo item to enter edit mode. Modify the text and click Save to update, or Cancel to revert your changes.
Deleting a Todo:
Click Delete on a todo item to remove it from the list.
/react-form
├── node_modules/
├── public/
│ └── index.html
├── src/
│ ├── App.jsx # Main component; handles state and form submission
│ ├── ChildComponent.jsx # Intermediate component for rendering the todo list
│ ├── TodoItem.jsx # Component for individual todos (editable and deletable)
│ ├── index.css # Global styles with Tailwind CSS directives
│ └── index.jsx # Entry point for React
├── tailwind.config.js # Tailwind CSS configuration
├── package.json
└── README.md
Contributions are welcome! Follow these steps to contribute:
Fork the Repository
Create a Feature Branch
git checkout -b feature/YourFeature
Commit Your Changes
git commit -m 'Add some feature'
Push to Your Branch
git push origin feature/YourFeature
Open a Pull Request