What is React?
React is a JavaScript library used to build interactive user interfaces. It was created by Facebook (Meta) and allows developers to create reusable components that manage their own state.
- Component-based architecture
- Uses JSX syntax
- Efficient updates via Virtual DOM
- Declarative programming style
SPA & MPA
Single-Page Application (SPA)
A SPA loads only one HTML page and dynamically updates content without reloading the entire page.
- Faster navigation after first load
- Better user experience
- Needs client-side routing
Multi-Page Application (MPA)
In MPA, every page request loads a new HTML document from the server.
- Better SEO support
- Simple structure for static sites
- Slower navigation (page reloads)
Angular vs React vs Vue vs Next.js
| Technology | Type | Key Features |
|---|---|---|
| Angular | Framework | Full-featured, opinionated, TypeScript-based |
| React | Library | Flexible, component-based, huge ecosystem |
| Vue | Framework | Easy to learn, lightweight, reactivity system |
| Next.js | Framework (React-based) | Server-side rendering, SEO-friendly, file-based routing |
Library vs Framework
The main difference is in control flow:
With a Library, you call the code.
With a Framework, the code calls you.
- Library: You’re in control (React, jQuery)
- Framework: Structure controls you (Angular, Next.js)
DOM vs Virtual DOM
The DOM (Document Object Model) represents the structure of a webpage. Manipulating the DOM directly is slow because the browser must re-render the page.
The Virtual DOM is a lightweight copy used by React to track changes and update only the necessary parts of the real DOM, improving performance.