React for beginners
- Jul 01, 2025
- Software Development
- 10 Views
🚀 Getting Started with React1. Why React?
Declarative and component-based—letting you build reusable UI pieces.
Huge ecosystem and community support.
Ideal for modern, dynamic web interfaces.
2. Your First React App
Declarative and component-based—letting you build reusable UI pieces.
Huge ecosystem and community support.
Ideal for modern, dynamic web interfaces.
Use Create React App (CRA) to bootstrap your project:
It sets up a dev server with live reloading at http://localhost:3000.
3. Core Concepts
a. Components
Fundamental building blocks. Example functional component:
b. JSX
Looks like HTML but with full JavaScript power (e.g., embedding variables, expressions).
c. State & Props
Props: inputs from parent components.
State: internal data managed via useState.
d. Side Effects with useEffect
Run code after render—for data fetching or subscriptions.
🛠 Building a Simple To‑Do App
Step 1: Setup UI
Input field + “Add” button.
List of tasks with a “Done” checkbox.
Step 2: Manage State
const [tasks, setTasks] = useState([]);
Add, complete, or filter tasks easily using state.
Step 3: Render Task List
Map over tasks and generate
Step 4: Add Features
Remove tasks
Edit tasks
Persist tasks in localStorage