Uses of React
Learn where React is used in real-world applications, from training portals and admin dashboards to e-commerce websites and interactive forms.
1. Where Is React Used?
React is a JavaScript library used to build user interfaces. It is useful when an application needs reusable UI components, interactive elements, or screens that change when data changes.
For example, CIIT Training Institute could use React to create course listings, student dashboards, enquiry forms, online learning pages, and interactive assessment screens.
2. React in a Real-World Application
The following diagram shows examples of application areas in which React components can be useful.
Training Portal
Courses, student profiles, and learning progress.
E-Commerce
Products, shopping carts, and filters.
Admin Dashboard
Tables, metrics, charts, and reports.
Online Forms
Registration, validation, and submission.
Reusable React Components
Each application can organize its interface into components suited to its requirements.
3. Use Case: Training Institute Website
A training institute can use React to display courses, course durations, descriptions, and enrolment links. A reusable component makes it easier to present multiple courses with the same layout.
React Code
interface Course {
id: number;
name: string;
duration: string;
}
const courses: Course[] = [
{ id: 1, name: "React", duration: "3 months" },
{ id: 2, name: "Python", duration: "4 months" },
{ id: 3, name: ".NET", duration: "4 months" }
];
function CourseList() {
return (
<section>
<h2>Our Courses</h2>
{courses.map(course => (
<article key={course.id}>
<h3>{course.name}</h3>
<p>Duration: {course.duration}</p>
</article>
))}
</section>
);
}
export default CourseList;
Expected Output
Our Courses
React
Duration: 3 months
Python
Duration: 4 months
.NET
Duration: 4 months
- The
Courseinterface defines the course data structure. - The
coursesarray contains sample course records. map()creates UI elements for the course records.keyhelps React identify each item in the rendered list.
4. Use Case: E-Commerce Website
React can be used to build product listings, search filters, shopping carts, and interactive product details. State is useful when the quantity of an item changes.
Example: Product Information
interface Product {
id: number;
name: string;
price: number;
}
const product: Product = {
id: 101,
name: "Keyboard",
price: 1200
};
function ProductCard() {
return (
<article>
<h3>{product.name}</h3>
<p>Price: ₹{product.price}</p>
<button>Add to Cart</button>
</article>
);
}
export default ProductCard;
Expected Output
Keyboard
Price: ₹1200
Static preview only. The button is illustrative and does not add an item to a real shopping cart.
5. Use Case: Admin Dashboard
Admin dashboards often show summaries, tables, activity indicators, and reports. React components can separate each dashboard section so that the data and presentation remain organized.
Total Students
250
Available Courses
12
New Enquiries
18
Completed Batches
8
6. Use Case: Student Registration Form
React is useful for interactive forms that collect user information, validate fields, and display messages as data changes.
React Code
import { useState } from "react";
function StudentForm() {
const [name, setName] = useState("");
function handleSubmit(
event: React.FormEvent<HTMLFormElement>
) {
event.preventDefault();
if (name.trim() === "") {
alert("Please enter your name.");
return;
}
alert("Welcome, " + name + "!");
}
return (
<form onSubmit={handleSubmit}>
<label htmlFor="studentName">
Student Name
</label>
<input
id="studentName"
value={name}
onChange={event => setName(event.target.value)}
/>
<button type="submit">Register</button>
</form>
);
}
export default StudentForm;
How It Works
Enter Name
The student types into the input field.
Validate
The submit handler checks the name.
Show Result
A message is shown for the entered value.
7. Other Applications of React
Messaging Interfaces
Display conversation lists, messages, notifications, and user status.
Media Applications
Build media listings, filters, playback controls, and profile interfaces.
Reporting Tools
Display tables, visual summaries, filters, and data-driven reports.
Learning Platforms
Build lesson lists, quizzes, progress screens, and interactive learning activities.
8. Application Requirements and React Features
| Application | Possible React Features | Example Component |
|---|---|---|
| Training Portal | Components, props, lists | CourseCard |
| E-Commerce | State, events, conditional rendering | ShoppingCart |
| Admin Dashboard | Reusable components and data rendering | StatisticsCard |
| Registration Form | State, events, and validation | StudentForm |
| Learning Platform | Routing, state, and lists | LessonList |
Summary
- React can build course portals and learning management interfaces.
- E-commerce applications can use state and events for interactive shopping features.
- Dashboards can use reusable components to display data summaries.
- Forms can use state and event handlers to manage user input.
- Lists and props help render collections of courses or products.
- The right component structure depends on each application's requirements.