React is a JavaScript library for building user interfaces. In practice, developers use it to build web apps from small reusable pieces called components. Each component describes what part of the screen should look like, React keeps that view in sync with data, and the browser shows the result.
In simple terms:
- React helps you build interactive screens.
- Components are the basic building blocks.
- JSX lets you write HTML-like markup inside JavaScript.
- State is the data that changes as people use the app.
- Hooks are functions that let components use React features.
- React is not a complete web framework by itself. You still choose routing, data fetching, styling, testing, hosting, and often a framework.
| Question | Short answer |
|---|---|
| What is React? | A JavaScript library for building user interfaces. |
| Who uses it? | Frontend developers, full stack developers, product teams, agencies, SaaS teams and app builders. |
| What does it build? | Interactive websites, dashboards, forms, admin panels, content apps, ecommerce interfaces and web app frontends. |
| Is React a framework? | Technically no. It is a UI library, although people often talk about it like a framework. |
| Main idea | Build the UI from reusable components, then update the screen when data changes. |
| Best first stack | React with TypeScript and Vite for a simple app, or a React framework when routing, server rendering and data loading matter. |
The plain-English version
React is a way to organise a web interface so it does not turn into a pile of tangled HTML, CSS and JavaScript.
Instead of manually finding DOM nodes and changing them one by one, you describe the screen for a given state. If the state changes, React works out what needs to change in the browser.
That is the bit that makes React click.
state changes -> React renders components -> browser updates the UIA counter is the smallest useful example:
import { useState } from 'react';
export default function Counter() {
const [count, setCount] = useState(0);
return (
<button onClick={() => setCount(count + 1)}>
Clicked {count} times
</button>
);
}There is not much code there, but it shows the core idea. The component has state, the user clicks, the state changes, and React updates the button text.
Why developers use React
Developers reach for React because modern web applications are full of repeated interactive pieces: navigation menus, buttons, forms, modals, filters, dashboards, cards, tabs, settings pages and checkout flows.
React gives those pieces a consistent shape.
| Developer problem | How React helps |
|---|---|
| Repeated UI patterns | Turn them into reusable components. |
| Complex user interaction | Store changing data in state and re-render from that state. |
| Large interfaces | Split the UI into smaller files and components. |
| Data passed through the UI | Use props, context, reducers and data libraries. |
| Conditional screens | Render different markup from normal JavaScript conditions. |
| Lists and dynamic content | Map data arrays into UI elements. |
| Team collaboration | Components create boundaries that teams can design, test and reuse. |
| Product iteration | Change one component and use it across multiple screens. |
React is popular because the component model maps neatly to how product teams think. A design system has buttons, cards and forms. A React codebase can have the same things as components.
React is a library, not the whole application
This matters more than beginners expect.
React handles the view layer. It helps you build the UI. It does not, by itself, make every decision a production web app needs.
| Need | Does React include it by default? | Common choices |
|---|---|---|
| Components and rendering | Yes | React |
| Local state | Yes | useState, useReducer |
| Effects and browser integration | Yes | useEffect, useRef |
| Routing | No | React Router, TanStack Router, framework router |
| Server rendering | Not as a standalone app setup | Next.js, Remix, React Router framework mode, custom SSR |
| Data fetching | No single default | Framework loaders, TanStack Query, SWR, server functions, fetch |
| Styling | No single default | CSS modules, Tailwind, vanilla CSS, styled-components, design systems |
| Forms | Basic browser forms plus React patterns | React Hook Form, framework actions, native forms |
| Testing | No | Vitest, Testing Library, Playwright, Cypress |
| Build tooling | No | Vite, Parcel, Rsbuild, framework tooling |
| Deployment | No | Vercel, Netlify, Cloudflare, static hosts, containers |
That is not a weakness. It is the tradeoff. React gives you a strong UI model and leaves room to choose the rest of the stack.
The building blocks of React
Most React learning paths are less mysterious when you see the pieces together.
| Concept | What it means | Tiny example | When you use it |
|---|---|---|---|
| Component | A reusable UI function | function Button() { return <button /> } | Almost everywhere. |
| JSX | HTML-like syntax inside JavaScript | <h1>{title}</h1> | To describe markup in components. |
| Props | Data passed into a component | <Card title="Hello" /> | To configure reusable components. |
| State | Data a component remembers | const [open, setOpen] = useState(false) | Forms, toggles, filters, tabs, modals. |
| Event handler | A function called after user interaction | onClick={handleClick} | Buttons, inputs, forms, drag and drop. |
| Hook | A function that uses React features | useState, useEffect | State, effects, refs, context and performance. |
| Context | Shared data without prop drilling | useContext(ThemeContext) | Theme, auth user, locale, app config. |
| Ref | A mutable value or DOM reference | const inputRef = useRef(null) | Focus, measuring, timers, non-React APIs. |
| Effect | Sync with an external system | useEffect(() => {}, []) | Network connections, browser APIs, subscriptions. |
If you understand those, you understand the everyday shape of React work.
Components are the centre of React
A component is a piece of UI with its own logic and appearance. It can be tiny, like a button, or large, like a whole page.
function ProductCard({ name, price }) {
return (
<article className="product-card">
<h2>{name}</h2>
<p>${price}</p>
<button>Add to cart</button>
</article>
);
}Then you can use it like this:
<ProductCard name="Keyboard" price="149" />
<ProductCard name="Mouse" price="79" />The practical benefit is reuse. You design the card once, make it flexible with props, then render it wherever you need it.
| Component type | Example | Usual job |
|---|---|---|
| Primitive UI component | Button, Input, Badge | Small reusable building block. |
| Layout component | Header, Sidebar, Grid | Structure the page. |
| Feature component | ProductCard, UserMenu, SearchBox | Own a specific product feature. |
| Page component | DashboardPage, CheckoutPage | Compose many smaller components. |
| Provider component | ThemeProvider, AuthProvider | Share app-level context. |
A good React app usually feels like a tree of components, not a long script that pokes at the page.
JSX is JavaScript with markup in it
JSX is the syntax most React developers use to describe UI. It looks like HTML, but it is stricter and it lives inside JavaScript.
const user = { name: 'Ada', role: 'Developer' };
function Profile() {
return (
<section className="profile">
<h2>{user.name}</h2>
<p>{user.role}</p>
</section>
);
}The curly braces switch back into JavaScript. That lets you display variables, call functions, build class names, render lists and choose what appears on the screen.
JSX has a few rules that trip people up early.
| JSX rule | HTML habit that breaks | Correct React version |
|---|---|---|
Use className | <div class="box"> | <div className="box"> |
| Close tags | <img> | <img /> |
| Return one parent | Two sibling elements at the top | Wrap with <div> or <>...</> |
Use {} for JavaScript | src="user.avatar" | src={user.avatar} |
| Use camelCase for many attributes | onclick | onClick |
JSX is not required, but most React teams use it because the UI structure is easy to read at a glance.
Props, state and events
These three concepts do a lot of work.
Props are inputs. State is memory. Events are what happen when users interact.
| Concept | Direction | Changed by | Example |
|---|---|---|---|
| Props | Parent to child | Parent component | A Button receives label="Save". |
| State | Inside a component or shared higher up | Setter function or reducer | A modal stores whether it is open. |
| Event | Browser or component interaction | User action or app event | A click submits a form or opens a menu. |
Here is a simple form field:
import { useState } from 'react';
function NameField() {
const [name, setName] = useState('');
return (
<label>
Name
<input
value={name}
onChange={(event) => setName(event.target.value)}
/>
<p>Hello, {name || 'stranger'}.</p>
</label>
);
}The input value comes from state. The onChange event updates that state. React renders the greeting from the latest value.
That pattern appears everywhere in React apps.
The mental model: describe the result, not every DOM step
Old-school DOM scripting often looks like this:
Find the element.
Change its text.
Add a class.
Remove another class.
Disable a button.
Show a message.React pushes you towards a different approach:
What state is the app in?
What should the UI look like for that state?A login form might have states like this.
| State | UI should show |
|---|---|
idle | Empty form and enabled submit button. |
typing | Current input values. |
submitting | Disabled submit button and loading text. |
success | Success message or redirect. |
error | Error message and editable form. |
This makes UI bugs easier to reason about because the screen follows the data.
Hooks without the mystery
Hooks are special functions that let React components use React features. They are just functions, but they follow React's rules.
The hooks beginners see first are these.
| Hook | Use it for | Avoid using it for |
|---|---|---|
useState | Simple local state. | Complex state transitions that would be clearer as a reducer. |
useReducer | State with multiple actions or rules. | Tiny toggles and simple form fields. |
useContext | Reading shared app data. | Frequently changing data across huge trees without considering performance. |
useRef | DOM nodes and mutable values that should not trigger rendering. | Data that must appear in the UI. |
useEffect | Synchronising with an external system. | Calculating normal rendered output. |
useMemo | Caching expensive derived calculations. | Making every calculation look optimised. |
useCallback | Keeping function identity stable where it matters. | Wrapping every function by habit. |
The most common beginner mistake is reaching for useEffect too quickly. If you can calculate something from props or state during render, do that instead.
function InvoiceTotal({ items }) {
const total = items.reduce((sum, item) => sum + item.price, 0);
return <p>Total: ${total}</p>;
}You do not need an effect for that. The value is derived from existing data.
How React turns components into a web page
A React app has three broad phases when something changes.
| Phase | What happens | Developer translation |
|---|---|---|
| Trigger | Something causes an update. | A user clicks, data arrives, state changes. |
| Render | React calls components to work out the next UI. | Your component functions run and return JSX. |
| Commit | React applies changes to the DOM. | The browser screen updates. |
React does not blindly redraw the whole page in the way people sometimes imagine. It works out what changed and updates the DOM accordingly.
As a developer, you usually focus on writing pure components: given the same props and state, the component should return the same UI.
How to start a React app
For a simple client-side React app, Vite is a common starting point.
npm create vite@latest my-react-app -- --template react-ts
cd my-react-app
npm install
npm run devThat gives you a local development server and a modern build setup. For production, you usually run:
npm run build
npm run previewA typical small React project might look like this:
my-react-app/
src/
App.tsx
main.tsx
components/
Button.tsx
ProductCard.tsx
pages/
HomePage.tsx
styles/
global.css
package.json
vite.config.tsThe exact structure is not sacred. React gives you flexibility, which is useful once you know what you are doing and a little dangerous when you do not.
What React does not decide for you
React's flexibility means you must make some architecture choices.
| Decision | Small app choice | Larger app choice |
|---|---|---|
| Language | JavaScript | TypeScript |
| Build tool | Vite | Framework tooling or Vite with conventions |
| Routing | One page or React Router | File-based or framework router |
| Data fetching | fetch in event handlers or simple effects | Framework loaders, TanStack Query, server routes |
| Forms | Controlled inputs | React Hook Form, server actions, schema validation |
| Styling | CSS modules or plain CSS | Design system, Tailwind, tokens, component library |
| State | Local state | Reducers, context, external store, server cache library |
| Testing | Manual plus a few unit tests | Unit, integration and browser tests |
| Rendering | Client-side rendering | SSR, SSG, RSC or hybrid rendering |
| Deployment | Static hosting | Edge, serverless, Node server or platform framework |
A small dashboard can be fine with React, Vite and a router. A content-heavy public site probably wants server rendering or static generation. A complex SaaS product needs stronger conventions around data, permissions, forms and testing.
React and frameworks like Next.js
React is the UI library. A framework adds app-level decisions around routing, rendering, data loading, file structure and deployment.
| Option | What it is | Good for | Watch out for |
|---|---|---|---|
| React with Vite | React plus a fast build tool. | Learning, prototypes, SPAs, internal tools. | You choose routing, data fetching and SSR yourself. |
| React Router framework mode | React app framework built around routing and data loading. | Apps where routes and loaders are central. | Different mental model from a simple Vite SPA. |
| Next.js | React framework with routing, server rendering, static generation and Server Components support. | Public sites, SaaS apps, hybrid rendering. | More framework behaviour to learn. |
| Remix-style architectures | Route-centric full stack React patterns. | Forms, mutations, web fundamentals. | Requires comfort with server boundaries. |
| Custom setup | Your own combination of React, bundler, router and server. | Special constraints. | You own the framework problems. |
My usual advice: learn React fundamentals first, then learn a framework. If you skip the fundamentals, the framework feels like magic. If you only learn bare React, production apps can feel under-specified.
How developers use React to build real web applications
A real React app is not just a pile of components. It is a set of decisions that fit together.
| Step | What you do | Practical output |
|---|---|---|
| 1. Define screens | List pages, user journeys and app states. | Route map and rough UI plan. |
| 2. Break UI into components | Identify repeated pieces. | Button, Card, Layout, FormField, Modal. |
| 3. Model data | Decide what comes from props, state, server data or context. | Data flow diagram or state notes. |
| 4. Build static UI first | Render the interface with sample data. | Components that look right. |
| 5. Add interactivity | Wire events and state. | Clicks, forms, filters, tabs, menus. |
| 6. Add data fetching | Connect APIs, loaders or server functions. | Real data on the screen. |
| 7. Handle edge cases | Loading, empty, error and permission states. | UI that survives real use. |
| 8. Test important paths | Unit, integration and browser tests where useful. | Confidence before shipping. |
| 9. Build and deploy | Optimise, build and host. | Production app. |
That order keeps you honest. If the static UI is messy, adding state will not fix it. If the data model is messy, adding a state library will not fix it either.
Common React application patterns
| Pattern | What it solves | Typical React approach |
|---|---|---|
| Controlled form | Keep form input in sync with state. | value plus onChange. |
| Modal | Show or hide a dialog. | Boolean state such as isOpen. |
| Tabs | Switch visible panels. | State for selected tab. |
| Search filter | Filter a list as the user types. | Input state plus derived filtered list. |
| Data table | Display and sort rows. | Props for rows, state for sort and filters. |
| Auth-aware UI | Show different UI for logged-in users. | Context or framework session data. |
| Theme switcher | Share theme across components. | Context, CSS variables, local storage. |
| API-backed page | Load server data and display states. | Framework loader or query library. |
| Optimistic update | Show change before server confirms. | React 19 useOptimistic or data library support. |
The important habit is to model the UI state deliberately. Do not scatter copies of the same data across half a dozen components unless there is a very good reason.
React compared with nearby options
React is not the only way to build web interfaces. The right comparison depends on what you are building.
| Option | Main idea | Strength | Tradeoff |
|---|---|---|---|
| Plain JavaScript | Use browser APIs directly. | No framework dependency. | Harder to organise large interactive UIs. |
| jQuery | Easier DOM manipulation. | Simple for older sites and small enhancements. | Imperative style becomes messy in app-like interfaces. |
| React | Component-based UI library. | Flexible, huge ecosystem, strong mental model. | You choose many app-level pieces. |
| Vue | Progressive UI framework. | Friendly syntax and integrated conventions. | Smaller ecosystem in some enterprise contexts. |
| Angular | Full application framework. | Batteries included, strong structure. | Heavier learning curve and more framework ceremony. |
| Next.js | React framework. | Routing, rendering and server features around React. | More moving parts than React alone. |
| Svelte | Compiler-first UI framework. | Less runtime overhead and concise syntax. | Different ecosystem and mental model. |
React is a good default when you want a broad ecosystem and a component model that many developers already know. It is less appealing if you want one official answer for every architectural decision.
React 19, Actions and Server Components
React 19 matters because it continues shifting React beyond purely client-side UI code.
The headline features for everyday developers are around async workflows and forms. Actions let React handle common mutation states such as pending, errors and optimistic updates more directly. Hooks like useActionState and useOptimistic support those patterns.
Server Components are the bigger architectural idea. A Server Component can render ahead of time, at build time or per request, in an environment separate from the client app. That can keep server-only work and heavy libraries out of the browser bundle.
| Feature | Plain-English meaning | Who should care |
|---|---|---|
| Actions | A convention for async updates such as form submissions. | Developers building interactive forms and mutations. |
useActionState | Tracks the result and pending state of an action. | Form-heavy apps. |
useOptimistic | Shows an expected result before the server confirms. | Apps with likes, comments, carts and fast feedback. |
| Server Components | Components that render away from the browser. | Developers using modern React frameworks. |
| Improved metadata and asset handling | React can handle more document and loading concerns. | Framework and app developers. |
If you are new to React, do not start with Server Components. Start with components, props, state and hooks. Then learn how your chosen framework uses the server.
Best practices that save pain later
React codebases usually go wrong in predictable ways. The fixes are not glamorous, but they work.
| Practice | Why it helps |
|---|---|
| Keep components small enough to understand. | Large components hide state bugs and duplicated logic. |
| Name props clearly. | A component should be understandable from how it is used. |
| Derive values during render where possible. | Avoids duplicated state. |
| Lift state only when needed. | Keeps unrelated components independent. |
| Keep effects for external systems. | Reduces accidental render loops and stale data. |
| Handle loading, empty and error states. | Real apps rarely have perfect data. |
| Use TypeScript for serious apps. | Catches many prop and data-shape mistakes early. |
| Test behaviour, not implementation details. | Users care what the UI does, not which hook you used. |
| Choose a framework when the app needs one. | Avoids rebuilding routing, SSR and data conventions yourself. |
A clean React app is usually boring in the best way. Data flows down, events flow up, and state lives in the smallest sensible place.
Mistakes I see developers make with React
| Mistake | Why it hurts | Better approach |
|---|---|---|
| Storing derived data in state | Values drift out of sync. | Calculate from existing state or props. |
Using useEffect for everything | Creates extra renders and confusing data flow. | Use render calculations, event handlers or framework data APIs. |
| Passing props through too many layers | Components become plumbing. | Use composition, context or route-level data. |
| Global state too early | Makes simple state feel complex. | Start local, lift when needed. |
| Ignoring accessibility | Components work for fewer people. | Use semantic HTML, labels, focus states and keyboard support. |
| Building a custom framework accidentally | Routing, SSR and data loading become maintenance work. | Use a framework when the app shape calls for it. |
| Treating React as the backend | React renders UI. | Use APIs, server functions, databases and auth systems separately. |
The pattern behind most mistakes is the same: using a tool before the problem asks for it.
A practical React learning path
If you are learning React now, I would not start by memorising every API. Learn the working set first.
| Stage | Learn | Build |
|---|---|---|
| 1 | Components, JSX, props | Profile cards, product cards, layout sections. |
| 2 | State and events | Counter, tabs, modal, form fields. |
| 3 | Lists and conditions | Todo list, filtered products, empty states. |
| 4 | Forms | Signup form, validation messages, submission state. |
| 5 | Effects and refs | Focus an input, sync with browser APIs, simple fetch. |
| 6 | Routing | Multi-page app with URL routes. |
| 7 | Server data | API-backed dashboard with loading and error states. |
| 8 | Testing | Test form behaviour and important user journeys. |
| 9 | Frameworks | Next.js, React Router framework mode or another React stack. |
| 10 | Performance | Memoisation, code splitting, rendering strategy. |
A good first serious project is a small dashboard with authentication mocked out, a few routes, real forms, filters, API data and tests for the most important paths. That teaches more than another isolated counter tutorial.
FAQ about React
Is React hard to learn?
React is approachable if you already know JavaScript, HTML and CSS. The hard part is not the component syntax. The hard part is learning state, data flow, effects, tooling and the wider ecosystem.
Do I need TypeScript with React?
No, but I would use it for most serious projects. TypeScript makes component props, API responses and shared types much safer as the app grows.
Can React build a whole website?
Yes, but React alone is only the UI layer. For a full website or application, you also need decisions about routing, data loading, rendering, styling, testing and deployment. A React framework can handle many of those decisions.
Is React good for SEO?
React can be good for SEO when rendered appropriately. A purely client-rendered app can be weaker for public content if it delays meaningful HTML. For SEO-heavy sites, use server rendering, static generation or a framework that outputs crawlable pages.
Should I learn React before Next.js?
Yes. You do not need to master all of React first, but you should understand components, props, state, events, hooks and rendering before going deep into Next.js. Otherwise you end up debugging both React and the framework at once.
What is the difference between React and React Native?
React is the UI model. ReactDOM renders React components to the web DOM. React Native uses React ideas to build native mobile interfaces. The concepts overlap, but the rendered elements and platform APIs differ.
Does React replace HTML and CSS?
No. React uses HTML-like JSX and still relies on CSS or styling tools. Good React developers still need strong HTML, CSS, accessibility and browser fundamentals.
When should I not use React?
Do not reach for React by reflex. A simple marketing page, small static site or server-rendered form might be easier without a full React app. React earns its keep when the interface is interactive, component-heavy or likely to grow.
The bottom line
React is a component model for building user interfaces with JavaScript. Its power is not that it makes every web problem disappear. It gives developers a clear way to build interactive screens from reusable pieces and keep those screens in sync with changing data.
For a developer, the sensible path is simple: learn components, JSX, props, state and hooks. Build a few real interfaces. Then decide whether your app needs a simple Vite setup or a fuller React framework.
React is best when you treat it as the UI layer in a deliberate application stack, not as a magic answer to the whole web.

About the author
Hi, I'm Jason Futrill.
I'm an tech professional and commentator exploring how intelligent systems are reshaping work, creativity, and society.
More about me



