
React is a JavaScript library for building user interfaces out of small, reusable pieces called components. It powers Facebook, Instagram and Netflix and is one of the most requested front-end skills. React itself is not hard, but it is easy to get lost in the tools around it. The way through is to learn in the right order and build something at every step.
React was created at Facebook by engineer Jordan Walke and released as open source in 2013. Its big idea was declarative UI: you describe what the interface should look like for a given state, and React updates the page for you. Early React code used class components. In 2019 hooks arrived, letting plain functions hold state and side effects, and today function components with hooks are the standard way to write React.
Most React confusion is really JavaScript confusion. Before you start, make sure you can use these features without looking them up:
If these feel shaky, a structured plan for learning JavaScript in 30 days will save you weeks of frustration. Basic HTML and CSS are also assumed.
Install a current LTS version of Node.js, then create a project with Vite, a fast build tool: run npm create vite@latest, pick React and JavaScript, then run npm install and npm run dev. The app updates instantly when you save a file. Avoid Create React App, which older tutorials mention: it has been deprecated. Also install the React Developer Tools browser extension.
A component is a JavaScript function that returns markup written in JSX, a syntax that looks like HTML inside JavaScript. A minimal example is function Greeting() { return <h1>Hello!</h1>; }, used like a tag: <Greeting />. A few JSX rules trip up every beginner:
Practise by splitting a simple page into components such as Header, ProductCard and Footer.
Props are the inputs of a component, passed like HTML attributes: <Greeting name="Ana" />. Inside, you read them from the function parameter, usually with destructuring: function Greeting({ name }). Props flow one way, from parent to child, and a component should never modify its own props. To show a list, use map to turn an array into elements, and give each item a stable key, such as a database ID.
State is data that changes over time and makes the component re-render. You create it with the useState hook: const [count, setCount] = useState(0). Handle a click with onClick={() => setCount(count + 1)}. Two rules matter: call hooks only at the top level of a component, never inside loops or conditions, and never mutate state directly. To update an array or object, create a new copy, for example setItems([...items, newItem]). When two components need the same data, lift the state up to their closest common parent and pass it down as props.
The useEffect hook synchronises a component with something outside React, such as a timer, a browser API or a network request. Its dependency array controls when it runs, and missing dependencies are a classic bug. Values calculated from props or state need no effect; compute them during rendering. For real data, practise once with fetch inside an effect, handling loading and error states, then move to a library such as TanStack Query, which handles caching for you.
Knowledge only sticks when you build without a tutorial. Good first projects, in rising difficulty:
Keep your code in Git, and when a project works, deploy it for free and add the live link to your portfolio.
Once the basics feel natural, add tools one at a time: useContext for data many components need, useReducer for complex state, TypeScript for safer code, and tests with Vitest and React Testing Library. For production apps, the official documentation at react.dev recommends a framework such as Next.js or React Router, which add routing and server rendering. Learn plain React first, so you know what the framework adds.
Grade 10 Math: Functions and Reasoning - Quiz
1170 questions