MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
Capstone Project: Comprehensive Task and Todo Application0%
Study Materials
React.js for BeginnersProgress 0%
1.1Why React and Single-Page Architecture1.2Setting Up Modern React with Vite1.3React Project Directory Structure and Entry Points1.4Virtual DOM and React Render Cycle Explained
12.1Capstone Project: Comprehensive Task and Todo Application
HomeTutorialsReact.js for BeginnersCapstone Project: Comprehensive Task and Todo Application

Capstone Project: Comprehensive Task and Todo Application

Beginner12 min read•Updated: 2026-11-18•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

1. Project Overview & Architecture

To conclude the React.js for Beginners curriculum, we will construct a production-grade Comprehensive Task and Todo Application that unites every foundational concept mastered across all 12 chapters:

  • Component Hierarchy & Composition: Clean separation between App, Header, InputForm, TaskList, TaskItem, and FilterToolbar.
  • State Management (useState): Managing task collections, filter tabs, and search terms.
  • Immutable Operations: Non-mutating adding, toggling, editing, and deleting of tasks.
  • Persistent Storage (useEffect): Synchronizing task state with browser localStorage.
  • Derived State: Computing active task counts, completion percentages, and filtered views without redundant state.
  • Accessible Interactions & Form Handling: Form submission, controlled inputs, keyboard shortcuts, and semantic badges.
1┌────────────────────────────────────────────────────────┐
2│ MSK Task & Productivity Master │
3│ │
4│ [ Add a new engineering task... ] [ + Add Task ] │
5│ │
6│ [ All (5) ] [ Active (2) ] [ Completed (3) ] │
7│ │
8│ Search: [ Filter tasks... ] │
9│ │
10│ Progress: [████████████████░░░░░░░░] 60% Done │
11│ │
12│ [✓] Master React Virtual DOM & Components │
13│ [✓] Practice useState and Immutable Updates │
14│ [ ] Build Capstone Full-Stack Application [Del] │
15│ │
16│ Clear Completed (3) 2 tasks remaining │
17└────────────────────────────────────────────────────────┘

2. Complete Application Source Code

1import React, { useState, useEffect } from 'react';
2 
3const STORAGE_KEY = 'msk_react_tasks_v1';
4 
5const INITIAL_TASKS = [
6 { id: 't-1', text: 'Set up Vite + React development environment', completed: true, category: 'Setup' },
7 { id: 't-2', text: 'Master JSX syntax and component composition', completed: true, category: 'Core' },
8 { id: 't-3', text: 'Implement useState and immutable array updates', completed: true, category: 'Core' },
9 { id: 't-4', text: 'Build production Capstone Task Manager', completed: false, category: 'Project' }
10];
11 
12export default function TaskMasterApp() {
13 // 1. State: Load initial tasks from localStorage lazily
14 const [tasks, setTasks] = useState(() => {
15 try {
16 const saved = localStorage.getItem(STORAGE_KEY);
17 return saved ? JSON.parse(saved) : INITIAL_TASKS;
18 } catch {
19 return INITIAL_TASKS;
20 }
21 });
22 
23 const [inputText, setInputText] = useState('');
24 const [selectedCategory, setSelectedCategory] = useState('Core');
25 const [filter, setFilter] = useState('all'); // 'all' | 'active' | 'completed'
26 const [searchQuery, setSearchQuery] = useState('');
27 
28 // 2. Persistent Storage Sync via useEffect
29 useEffect(() => {
30 localStorage.setItem(STORAGE_KEY, JSON.stringify(tasks));
31 }, [tasks]);
32 
33 // 3. Handlers
34 const handleAddTask = (e) => {
35 e.preventDefault();
36 if (!inputText.trim()) return;
37 
38 const newTask = {
39 id: `task-${Date.now()}`,
40 text: inputText.trim(),
41 completed: false,
42 category: selectedCategory
43 };
44 
45 setTasks((prev) => [newTask, ...prev]);
46 setInputText('');
47 };
48 
49 const handleToggleTask = (id) => {
50 setTasks((prev) =>
51 prev.map((t) => (t.id === id ? { ...t, completed: !t.completed } : t))
52 );
53 };
54 
55 const handleDeleteTask = (id) => {
56 setTasks((prev) => prev.filter((t) => t.id !== id));
57 };
58 
59 const handleClearCompleted = () => {
60 setTasks((prev) => prev.filter((t) => !t.completed));
61 };
62 
63 // 4. Derived State Calculations
64 const totalCount = tasks.length;
65 const completedCount = tasks.filter((t) => t.completed).length;
66 const activeCount = totalCount - completedCount;
67 const percentCompleted = totalCount === 0 ? 0 : Math.round((completedCount / totalCount) * 100);
68 
69 const filteredTasks = tasks.filter((t) => {
70 const matchesFilter =
71 filter === 'all' ? true : filter === 'active' ? !t.completed : t.completed;
72 const matchesSearch = t.text.toLowerCase().includes(searchQuery.toLowerCase());
73 return matchesFilter && matchesSearch;
74 });
75 
76 return (
77 <div className="task-app-container">
78 <header className="app-header">
79 <h1>MSK Task & Productivity Master</h1>
80 <p>Enterprise React Task Management Architecture</p>
81 </header>
82 
83 {/* Input Form */}
84 <form onSubmit={handleAddTask} className="task-form">
85 <input
86 type="text"
87 placeholder="What needs to be accomplished?"
88 value={inputText}
89 onChange={(e) => setInputText(e.target.value)}
90 className="task-input"
91 />
92 <select
93 value={selectedCategory}
94 onChange={(e) => setSelectedCategory(e.target.value)}
95 className="category-select"
96 >
97 <option value="Core">Core React</option>
98 <option value="Project">Project</option>
99 <option value="Setup">Setup</option>
100 <option value="Career">Career Prep</option>
101 </select>
102 <button type="submit" className="btn-add">Add Task</button>
103 </form>
104 
105 {/* Progress & Analytics Bar */}
106 <div className="progress-section">
107 <div className="progress-labels">
108 <span>Completion: {percentCompleted}%</span>
109 <span>{completedCount} of {totalCount} Completed</span>
110 </div>
111 <div className="progress-track">
112 <div className="progress-fill" style={{ width: `${percentCompleted}%` }} />
113 </div>
114 </div>
115 
116 {/* Filter & Search Toolbar */}
117 <div className="toolbar-row">
118 <div className="filter-buttons">
119 <button
120 className={filter === 'all' ? 'filter-active' : ''}
121 onClick={() => setFilter('all')}
122 >
123 All ({totalCount})
124 </button>
125 <button
126 className={filter === 'active' ? 'filter-active' : ''}
127 onClick={() => setFilter('active')}
128 >
129 Active ({activeCount})
130 </button>
131 <button
132 className={filter === 'completed' ? 'filter-active' : ''}
133 onClick={() => setFilter('completed')}
134 >
135 Completed ({completedCount})
136 </button>
137 </div>
138 
139 <input
140 type="text"
141 placeholder="Search tasks..."
142 value={searchQuery}
143 onChange={(e) => setSearchQuery(e.target.value)}
144 className="search-input"
145 />
146 </div>
147 
148 {/* Task List */}
149 <ul className="task-list">
150 {filteredTasks.length === 0 ? (
151 <li className="empty-message">No matching tasks found.</li>
152 ) : (
153 filteredTasks.map((task) => (
154 <li key={task.id} className={`task-item ${task.completed ? 'task-done' : ''}`}>
155 <label className="checkbox-label">
156 <input
157 type="checkbox"
158 checked={task.completed}
159 onChange={() => handleToggleTask(task.id)}
160 />
161 <span className="task-text">{task.text}</span>
162 </label>
163
164 <div className="task-actions">
165 <span className="category-tag">{task.category}</span>
166 <button
167 onClick={() => handleDeleteTask(task.id)}
168 className="btn-delete"
169 aria-label={`Delete task: ${task.text}`}
170 >
171 ✕
172 </button>
173 </div>
174 </li>
175 ))
176 )}
177 </ul>
178 
179 {/* Footer Summary */}
180 <footer className="app-footer">
181 <span>{activeCount} items remaining</span>
182 {completedCount > 0 && (
183 <button onClick={handleClearCompleted} className="btn-clear">
184 Clear Completed ({completedCount})
185 </button>
186 )}
187 </footer>
188 </div>
189 );
190}

3. Engineering Best Practices Demonstrated

  1. 1
    Lazy Initialization: useState(() => ...) reads localStorage only once when the component mounts, rather than on every render.
  2. 2
    Synchronous LocalStorage Sync: useEffect(() => { localStorage.setItem(...) }, [tasks]) guarantees data persistence whenever tasks change.
  3. 3
    Immutability Throughout: Using .map() for updates, .filter() for deletions, and spread [newTask, ...prev] for insertions preserves 100% data immutability.
  4. 4
    Clean Derived Filtering: Search and status filtering occur in real time during render with zero duplicated state.

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
Why is reading localStorage wrapped in a function inside useState(() => ...)?
Question 2
How does the application persist task updates across page reloads?
Question 3
How is a task's completed status toggled without mutating the original state array?
Question 4
How is the completion percentage calculated in the application?
Question 5
What happens when the user clicks "Clear Completed"?

Related Lessons

Previous LessonNext Lesson
Strict Mode and Detecting Unintentional Side EffectsNone

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master React.js for Beginners with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
Previous
PreviousPrevNext