Day 1
React Foundations & Setup
Understand what React is, why it exists, and get your development environment running with your first app.
Theory — Hour 1
What is React?
- React is a JavaScript library built by Meta for building fast, interactive user interfaces.
- It breaks a UI into small, reusable pieces called components — like LEGO blocks for web pages.
- React updates only the parts of the page that changed, making apps much faster than reloading the whole page.
Why React?
- Used by Facebook, Instagram, Airbnb, Netflix — the most popular front-end library in the world.
- One codebase can power web (React), mobile (React Native) and desktop apps.
- Massive community, tonnes of ready-made packages, and top demand in job market.
How the Web Works (Quick Recap)
- Browser downloads HTML (structure), CSS (style) and JavaScript (behaviour) from a server.
- React runs entirely in the browser — it writes HTML for you using JavaScript.
- The browser's DOM (Document Object Model) is the live tree of all page elements React controls.
Setting Up
- Install Node.js (comes with npm). Check: node -v and npm -v in terminal.
- Create a project: npx create-react-app my-app (classic) or npm create vite@latest (modern, faster).
- Folder structure: src/ holds your code, public/ holds static files, package.json lists dependencies.
Create and run your first React app
# Create project with Vite (recommended)
npm create vite@latest my-react-app -- --template react
cd my-react-app
npm install
npm run dev
# You'll see: Local: http://localhost:5173/Practical — Hour 2
- Install Node.js, create a Vite React project, start the dev server and view it in the browser.
- Open src/App.jsx, change the heading text, save and watch the browser update instantly (Hot Module Replacement).
Key Takeaways
- React = a JavaScript library for building UIs from reusable components.
- Vite is the modern, fast way to start a React project — prefer it over Create React App.
- The dev server auto-refreshes the browser every time you save a file.