A professional, fully-functional task management application built with React. This project demonstrates core React concepts including state management, hooks, component architecture, and local storage integration.
- ✅ Add new tasks with a clean input interface
- ✅ Mark tasks as completed with checkbox functionality
- ✅ Delete tasks you no longer need
- ✅ Filter tasks by status (All, Active, Completed)
- ✅ Real-time statistics showing total, active, and completed tasks
- ✅ Data persistence using browser's localStorage
- ✅ Responsive design that works on mobile and desktop
- ✅ Modern, gradient UI with smooth animations
- Node.js (version 14 or higher)
- npm (comes with Node.js)
-
Navigate to the project directory:
cd task-dashboard -
Install dependencies:
npm install
-
Start the development server:
npm start
-
Open your browser: The app will automatically open at
http://localhost:3000
task-dashboard/
├── public/
│ └── index.html # HTML template
├── src/
│ ├── App.js # Main component with all logic
│ ├── App.css # Styling for the application
│ ├── index.js # Entry point
│ └── index.css # Global styles
├── package.json # Project dependencies
└── README.md # This file
const [tasks, setTasks] = useState([]);- Manages the list of all tasks
- Updates trigger re-renders of the UI
useEffect(() => {
localStorage.setItem('tasks', JSON.stringify(tasks));
}, [tasks]);- Saves tasks to browser storage automatically
- Loads tasks when the app starts
- Form submission for adding tasks
- Click handlers for delete and toggle
- Input change handlers
- Shows different messages based on filter state
- Displays empty state when no tasks exist
.map()- Render list of tasks.filter()- Filter tasks by status- Immutable updates with spread operator
- User types in the input field
- Clicks "Add Task" or presses Enter
- New task object is created with unique ID
- Task is added to the state array
- useEffect automatically saves to localStorage
- User clicks checkbox
- App finds the task by ID
- Creates new array with updated task
- State is updated, triggering re-render
- Change is saved to localStorage
- User clicks filter button (All/Active/Completed)
- Filter state is updated
getFilteredTasks()function returns appropriate tasks- Only filtered tasks are displayed
- Gradient Background: Modern, eye-catching purple gradient
- Card-based Layout: Clean white container with shadow for depth
- Smooth Animations: Hover effects and transitions for better UX
- Accessible Colors: High contrast for readability
- Responsive: Works on all screen sizes
- React 18 - UI library
- CSS3 - Styling with modern features (Grid, Flexbox, Animations)
- localStorage API - Browser storage for data persistence
- ES6+ JavaScript - Arrow functions, destructuring, spread operator
If asked about future enhancements, you could mention:
- Add task editing functionality
- Implement task priorities (high/medium/low)
- Add due dates to tasks
- Create categories/tags for tasks
- Add search functionality
- Export tasks to JSON or CSV
- Add user authentication
- Sync with a backend database
Q: Why did you use useState instead of regular variables? A: Regular variables don't trigger React re-renders. When state changes with useState, React knows to update the UI automatically.
Q: What does the dependency array in useEffect do?
A: It tells React when to run the effect. An empty array [] runs once on mount. [tasks] runs whenever tasks change.
Q: Why use localStorage? A: It allows tasks to persist even when the user closes the browser. It's simple, doesn't require a backend, and works offline.
Q: How does the filter feature work? A: I maintain a filter state variable. When rendering, I use JavaScript's filter() method to return only tasks matching the current filter criteria.
Created as a portfolio project to demonstrate React fundamentals and modern web development practices.
This project is open source and available for educational purposes.