React is a free, open-source JavaScript library for building the parts of a website or app that people see and click. Meta (then Facebook) released it in 2013. Instead of writing one long page, you build small reusable pieces called components, such as a price card or a booking button, and assemble them into screens.
How React components and state work
A component is a function that returns a description of what should appear, written in JSX, a syntax that looks like HTML inside JavaScript. Components accept inputs called props, so one ProductCard can show a hundred different products. They can also hold state: values that change over time, like whether a menu is open or how many items are in a cart.
When state changes, React works out what the screen should now look like and updates only the parts of the page that differ. This is why you describe the result you want rather than writing step-by-step instructions to change the page. Newer versions also support server components and server rendering, so HTML can be produced before it reaches the browser.
Library, not full framework
React handles the interface. Routing between pages, data loading and building for production come from other tools. Many teams pair it with a build tool like Vite for a single page application, or use a framework built on React such as Next.js when they want server rendering and routing included.
An example: a menu that changes daily
A café has a MenuItem component showing a dish name, price and an allergen badge. The day's menu is a list of data, and React draws one MenuItem per entry. Add a "sold out" flag to one dish and only that card changes appearance. The layout code is written once and reused for every item.
When React matters for a small business
For visitors, the library itself is invisible. It matters when you choose who can maintain your site: React is one of the most widely used front-end libraries, so finding a developer who knows it is easy. It suits interactive sites such as booking flows, dashboards and stores. A purely static five-page site can be built without it, though it works fine there too when the output is pre-rendered.
Common React mistakes
- Rendering everything in the browser only. Content that appears after scripts run can be slower to show and to index.
- Giant components. One thousand-line file defeats the point of reusable pieces.
- Missing keys in lists. Without a stable key per item, React can mix up which row is which after updates.
- Adding a library for every small need, which inflates the bundle visitors download.
Related terms
- JavaScript framework: how React compares to Vue, Angular and others.
- Single page application: a common way React apps are delivered.
- TypeScript: often used to type React components.
- Frontend: the layer of a product React builds.