What Is RAG? How AI Answers from Your Own Documents
RAG lets AI look up your documents before answering instead of relying on memory. This article builds a mini RAG on five gnurtlab.com articles and…
What is React, and why do so many web developer job posts mention it? Open any online store and you will see like buttons, a cart, a price filter, and a product list that scrolls on and on. Each of those spots changes the moment you touch it, with no page reload.
React is often behind those instant changes. This article does not stop at a definition. I will run a real counter button in React, then write the same button in plain JavaScript, so you can see where the difference lies and why React is a library rather than a framework, as many people call it.
The point of this article: React is worth learning not because it is popular, but because it changes how you think about interfaces. Instead of telling the browser to fix each spot by hand, you describe the interface for each value of your data, and React takes care of the rest.
Quick summary
- React is an open source JavaScript library for building interfaces from reusable components.
- With the same counter button, plain JavaScript makes you update each spot by hand, while React only asks you to describe the interface for each state.
- React is not a framework: it does not handle routing or data fetching, you add other tools when you need them.
In one sentence: React is an open source JavaScript library for building user interfaces from small pieces called components. The react.dev home page opens with exactly that line: React is the library for web and native user interfaces. Jordan Walke, an engineer at Facebook, created it. React first ran inside Facebook on News Feed in 2011. It became open source at JSConf US in May 2013. Meta and the community maintain it today under the MIT license, which means you can use it free of charge, even in commercial projects.
The latest version at the time of writing is React 19.3.1, released on 14 October 2026, according to React's versions page. Version 19.3.0 came out on 9 September 2026, and the major release React 19 came out on 5 December 2024. You do not need to remember every date. What matters is that React is more than ten years old. Its basic syntax, function components with the useState hook, has been stable since version 16.8, released in February 2019. If you learn from the current docs, you are learning what people actually use at work.
Many people call React a framework. That label is wrong in one important way. A framework is a ready made skeleton for almost everything: project structure, page routing, data fetching. A library is the opposite: it solves one job, and you call it when you need it.
React only takes care of the interface. It ships with no routing, no built in way to call an API, and it forces no folder structure on you. If someone asks you "What is React" after reading this far, the honest answer is: a library for interfaces, nothing more. React.dev says this plainly. The site suggests a full stack framework such as Next.js or React Router when you want to build a whole app. Getting this right saves you from disappointment when you open React and find no page routing waiting for you.
A component is a JavaScript function that returns part of the interface. A like button is a component. A product card is a component. A list page is many components put together. Each component keeps its own data and redraws itself when that data changes.
Because a component is an ordinary function, you reuse it in many places without copying code. A page with ten identical counter buttons needs one component used ten times. This is the idea that runs through the whole article, and the live run below shows how much work it saves.
What is React for, once you know what it is? Before React, the usual way was plain JavaScript: find an element with querySelector, attach a click event, then fix textContent by hand each time the data changed. For one counter button, that way is short and nothing is wrong with it.
The trouble only shows up as the page grows. The short answer to "What is React" says nothing about why it exists, so here is the problem it was built to fix. A store page has a cart in the top right corner, a quantity for each item in the list, and a total at the bottom. Clicking the plus button on one item has to change three spots at the same time. Updating each spot by hand turns the code into a pile of DOM edits scattered everywhere. Fix one spot and you fear breaking another.
React exists to undo exactly that knot. Instead of telling the browser to fix each spot, you describe the interface for each value of your data. When the data changes, React works out which spots need fixing. You no longer have to keep a mental map of every place that needs updating.
Plain JavaScript struggles not because it is weak. It makes you do two jobs at once. The first job is to keep the data correct. The second job is to keep the screen in step with that data. As time goes on, the two jobs drift apart. You forget to update one spot, or you update twice, and the bug shows up as numbers that disagree on the same page.
React splits the two jobs apart. You only take care of keeping the data correct. React takes care of keeping the screen in step with the data. To compare them, I ran both ways on the same counter button.
The example for this article is a counter button: click the button, and the number on the screen goes up by one. It is simple on purpose, because the simpler it is, the clearer the difference. I ran both code samples for real on this machine. The machine used Node.js v24.22.1 and React 19.3.1. The results are at the end of this section. Running this example for real is the fastest way to understand what React is beyond a definition.
The HTML comes first, only two elements. One line of text shows how many times you clicked, and one button does the clicking.
<p id="count-text">You clicked 0 times</p>
<button id="count-button">Click here</button>
The JavaScript does three jobs. It takes the two elements and keeps the count variable. Then it attaches a click event that raises the count and fixes the text by hand.
let count = 0;
const text = document.querySelector('#count-text');
const button = document.querySelector('#count-button');
button.addEventListener('click', () => {
count = count + 1;
text.textContent = 'You clicked ' + count + ' times';
});
Look closely at the last line inside the click handler: you have to fix textContent yourself. Forget that line and the variable goes up while the screen stays still. With one button that is easy to remember. With ten spots showing the same number, you have to write the fix ten times by hand.
The React version uses JSX, a syntax that looks like HTML placed inside JavaScript. The component is a function, useState keeps the number, and onClick raises the number by one.
import { useState } from 'react';
export default function Counter() {
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>Click here</button>
</div>
);
}
The React version has no line that fixes the text on the screen directly. The function only returns the interface for the current value of count. When count changes, React redraws that part by itself. This is the biggest difference between the two ways.
I ran both code samples on this machine. Each version got three clicks, simulated as click events. The result: the React version printed "You clicked 3 times", and the plain JavaScript version printed the same sentence. Both versions show the same result on the screen. They only differ in how they get there. This run used React 19.3.1 with react-dom 19.3.1. Both were installed from npm on 6 December 2026.
You can run this example again at home. Install Node.js, start a project with Vite, paste the component in, then open the page and click. The steps at the end of the article walk you through it.
With one counter button, the two versions are about the same length. The React version is even a little longer, because it needs a component declaration. The React advantage only shows up as the numbers grow.
Suppose the page has ten separate counter buttons. The plain JavaScript version needs ten pairs of ids, ten event attachments, and ten hand written fixes. You also have to remember which spot goes with which number. The React version only uses the Counter component ten times, and each one keeps its own number. The code does not grow with the number of buttons.
Put it the way react.dev does: you design the interface for each state of your data. React updates and redraws the component when the data changes. You write code as if the whole page were redrawn on every change. React only fixes the part that really changed.
You already know the answer to "What is React". Three ideas are enough to read most React code written by others: state, re-rendering, and JSX. Once you have these three, the React docs hold no big surprises.
State is data that a component keeps for itself. In the example above, that is the count variable. useState is a hook, a special React function. It returns the current value and a function to change that value. Calling setCount(count + 1) tells React the data has changed.
When React hears that, it runs the component function again to work out the new interface. That rerun is called a render. You do not need to call render by hand. You should also not fix the DOM directly while React manages it, because the two sides will step on each other.
Hearing "redraw the whole component" makes many people think React wipes everything and draws it again from scratch. That would be slow. In practice React keeps a model of the interface in memory. It compares the model from before and after the data changed, then fixes only the part of the real DOM that truly differs. This process is called reconciliation.
That is why the "describe the whole interface again" style still runs fast in practice. You get to write simple code, and React takes care of the optimisation underneath. There are still cases where you need to optimise by hand, but for an ordinary page the default behaviour is enough.
JSX is a syntax extension for JavaScript. It looks like HTML, but you write it inside a JavaScript file. When it compiles, JSX turns into ordinary JavaScript function calls. You are not forced to use JSX. React still works in plain JavaScript. But most projects use JSX, because it reads close to the interface it creates.
One point often confuses people: the curly braces in JSX, like {count}, are where you drop a JavaScript value into the middle of the interface. That is only syntax for mixing code and interface in one place.
These three names often land in the same basket. But React differs from the other two in exactly one word: library or framework. The table below puts the three side by side, using the words each home page uses for itself.
| React | Angular | Vue | |
|---|---|---|---|
| What it is | Interface library | Full web framework | Progressive JavaScript framework |
| Made by | Meta and the community | An open source project | |
| Ships with | Only the interface | Routing, forms, HTTP, project structure | Interface core, routing and state management through official libraries |
| Fits when | You want to add it bit by bit to an existing page, or build an app with a framework on top | A large project needs one shared skeleton from the start | You want to start small and grow step by step |
In my view, there is no single answer for everyone. If you need one skeleton that decides almost everything from the start, Angular fits better. If you want to start small, drop React into one corner of an old page, and grow from there, React fits better. Vue sits between the two ends. In real life, many React projects still ship with a framework such as Next.js. The line between library and framework is blurrier in practice than it looks on paper.
| Wrong | Right |
|---|---|
| React is a framework. | React is a library that only takes care of the interface. For a full skeleton, add a framework such as Next.js. |
| Learning React means you can skip JavaScript. | React is written in JavaScript. Without solid variables, functions, arrays, and map, learning React will be hard work. |
| React only fits large apps. | React fits into one small corner of an old page. The react.dev home page says this plainly. |
| JSX is a new language. | JSX is a syntax extension for JavaScript. It compiles into ordinary JavaScript function calls. |
| React handles routing and API calls by itself. | React ships with neither. You add React Router or an API calling library. |
npm create vite@latest, answer a few questions, and pick React. Then run npm install and npm run dev, and open the address on the screen. I ran this exact chain of commands on 6 December 2026. The project it created used React 19.3.1 and built cleanly.If your goal is only a company page or a small shop site, you may not need React at all. The article What is WordPress on this site looks at when WordPress is already enough, and when hand written code becomes worth it. Read that one before you decide to go deep.
Yes. React is open source under the MIT license. You can use it free of charge, even in commercial projects. The source code is public on GitHub, in the facebook/react repository.
No. Plain JavaScript is enough for the first steps. TypeScript is an extra layer of type checking. Many projects use it, but it is not a requirement for starting.
Yes, through React Native, which uses the same component thinking to build Android and iOS apps. React Native was announced in 2015. This article only covers React for the web. Mobile apps are a separate topic.
No. To put it shortly: What is React? It is a library written in JavaScript, built for interfaces. You still need to know JavaScript to use React.
There is no single number, because it depends on your JavaScript base. Someone solid in JavaScript can often build a simple interactive page after a few weeks of steady work. Someone new to programming should think in months, and learn JavaScript first.
Knowing the answer to "What is React" is only the first step. If you followed the counter in this article, you already hold the most important idea in React. The interface is what shows up from the data. Your job is to keep the data right. Everything else, props, hooks, routing, is a way to grow that idea.
Here is the next step I suggest: build a to do list, where each item has a delete button. That task forces you to use an array in state. You also have to pass data between components, exactly the two things the counter never touched. Once that works, go back to the react.dev docs. The ideas there will land much faster.
Comments
You can use your Google account to comment. Google only shares your verified name and email address to display your name. You can log out at any time.
Sign in with GoogleNo comments yet. Be the first!