React JS Practice: Hands-On Projects & Lab Exercises

True programming mastery comes from writing code with your own hands. In this session, we present 5 complete, industry-grade practice projects with architectural breakdowns and complete code snippets that you can run locally.

Project 1: Persistent Task Manager (CRUD & LocalStorage)

Concepts Practiced: useState, useEffect, Array manipulation (map, filter), Form submission, and persistent browser storage.

import React, { useState, useEffect } from 'react';

export default function TaskManager() {
  const [tasks, setTasks] = useState(() => {
    const saved = localStorage.getItem('tasks');
    return saved ? JSON.parse(saved) : [];
  });
  const [inputVal, setInputVal] = useState('');

  useEffect(() => {
    localStorage.setItem('tasks', JSON.stringify(tasks));
  }, [tasks]);

  const handleAddTask = (e) => {
    e.preventDefault();
    if (!inputVal.trim()) return;
    setTasks(prev => [...prev, { id: Date.now(), text: inputVal, done: false }]);
    setInputVal('');
  };

  const toggleTask = (id) => {
    setTasks(prev => prev.map(t => t.id === id ? { ...t, done: !t.done } : t));
  };

  const deleteTask = (id) => {
    setTasks(prev => prev.filter(t => t.id !== id));
  };

  return (
    <div className="project-card" style={{ maxWidth: '400px', margin: '20px auto', padding: '20px', border: '1px solid #cbd5e1', borderRadius: '8px' }}>
      <h3>Task Manager Project</h3>
      <form onSubmit={handleAddTask}>
        <input value={inputVal} onChange={(e) => setInputVal(e.target.value)} placeholder="New task..." />
        <button type="submit">Add</button>
      </form>
      <ul style={{ listStyle: 'none', padding: 0, marginTop: '15px' }}>
        {tasks.map(t => (
          <li key={t.id} style={{ display: 'flex', justifyContent: 'space-between', padding: '6px 0', borderBottom: '1px solid #f1f5f9' }}>
            <span onClick={() => toggleTask(t.id)} style={{ textDecoration: t.done ? 'line-through' : 'none', cursor: 'pointer' }}>
              {t.text}
            </span>
            <button onClick={() => deleteTask(t.id)} style={{ color: 'red', border: 'none', background: 'none', cursor: 'pointer' }}>✕</button>
          </li>
        ))}
      </ul>
    </div>
  );
}

Project 2: Live Weather Forecaster (API Integration)

Concepts Practiced: Asynchronous data fetching, loading spinners, error handling, and search queries.

Next Step: Quick Reference Cheat Sheet

Complete your study with a handy summary of all syntax, commands, and hooks in React Quick Reference Cheat Sheet.

Explore Related React JS Tutorials

Accelerate your React mastery by studying these tightly connected core tutorials:

100+ Interview Q&A →

Test theoretical knowledge after coding exercises.

Quick Reference Cheat Sheet →

Syntax and hooks reference during coding.

Building Project Forms →

Controlled forms and validation patterns.

Global State in Practice →

Implementing shopping carts and task dashboards.

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!