React
Build interactive user interfaces with components, props, state, hooks, routing, and full-stack data flow.
React Fundamentals
5 minReact is a JavaScript library for building user interfaces out of small, reusable components. Instead of finding DOM nodes and changing them by hand, you describe what the UI sh...
JSX
5 minJSX is a syntax extension that lets you write HTML-like markup inside JavaScript. It is not HTML: a build tool (Vite/Babel) compiles every JSX tag into a plain JavaScript functi...
Components
4 minA component is a JavaScript function that returns JSX. Components are the building blocks of every React app: you split the UI into small pieces (a Navbar, a ProductCard, a Butt...
Props
4 minProps (short for properties) are how a parent component passes data to a child. They work like function arguments: the child receives one object and reads values from it. Props ...
State and useState
5 minState is data that a component remembers between renders and that, when changed, makes React render the component again. You create it with the useState hook, which returns the ...
Events
4 minReact lets you respond to user actions (clicks, typing, submits) by passing a function to an event prop like onClick. React wraps the browser event in a consistent object and ha...
Conditional Rendering
4 minConditional rendering means showing different UI depending on state or props. In React you use plain JavaScript - if, the ternary operator ? :, and && - to decide what a compone...
Lists and Keys
5 minTo show a collection of data, you transform an array into an array of JSX elements with .map(). Each element in the list needs a stable, unique key so React can tell which item ...
Forms and Controlled Components
5 minIn React, form inputs are usually controlled: their value lives in state, and every keystroke updates that state through onChange. React is then the single source of truth, whic...
useEffect
5 minuseEffect lets a component synchronize with something outside React after it renders: fetching data, adding event listeners, starting timers, changing the document title, or tal...
useRef
5 minuseRef gives you a mutable box (ref.current) that survives re-renders without causing one. It has two main jobs: holding a reference to a DOM element (to focus an input or scrol...
useContext
5 minContext lets a parent make a value available to every component below it, without passing it as a prop through each level ("prop drilling"). You create a context, wrap part of t...
Lifting State Up
5 minWhen two components need the same changing data, you cannot pass it sideways between siblings. Instead you move the state to their closest common parent and pass it down as prop...
Component Communication
4 minReact components talk to each other in a few well-defined ways. Data goes down from parent to child through props, and information goes up through callback functions that the pa...
Data Fetching in React
5 minMost real apps load data from an API. In React you fetch inside an effect (or an event handler), store the result in state, and render based on three situations: loading, error ...
Advanced Data Fetching
5 minBasic useEffect fetching works, but real apps hit extra problems: requests that finish out of order, requests for components that already left the screen, repeated loading of th...
React Router
5 minReact is a Single Page Application library: the page never fully reloads. React Router is the standard library that maps URLs to components, so /products shows one component and...
Search, Filter and Sort
4 minSearch, filter and sort are among the most common features in real React apps. The key idea: keep the original data and the user's choices (search text, selected category, sort ...
Persisting State with localStorage
4 minReact state disappears when the page is refreshed. The browser's localStorage stores small strings that survive reloads, so you can use it to remember a theme, a cart or a draft...
Protected Routes and Auth UI
6 minAuthentication in React is about the user interface: tracking who is logged in, showing the right buttons and redirecting guests away from private pages. The real security check...
Custom Hooks
5 minA custom hook is a JavaScript function whose name starts with use and that calls other hooks. It lets you extract and reuse stateful logic (not UI) between components: fetching,...
useReducer
5 minuseReducer is an alternative to useState for complex state where many different actions update related values. You write one pure reducer(state, action) function that describes ...
State Management
5 min"State management" is deciding where each piece of state lives and how components share it. Start simple: keep state local, lift it when siblings need it, use Context for app-wi...
React.memo
4 minBy default, when a component re-renders, all its children re-render too, even if their props did not change. React.memo wraps a component so React skips re-rendering it when its...
useMemo
4 minuseMemo caches the result of a calculation between renders and only recalculates it when its dependencies change. It helps in two cases: skipping an expensive computation, and k...
useCallback
4 minEvery render creates new function objects. useCallback returns the same function reference between renders as long as its dependencies do not change. This matters when the funct...
Performance Optimization
5 minMost React apps are fast enough without special effort. Optimize after measuring, and start with the biggest wins: avoid unnecessary work, render less, load less code and keep s...
Error Boundaries
5 minIf a component throws an error while rendering, React unmounts the whole tree and the user sees a blank page. An error boundary is a component that catches rendering errors in i...
Loading, Empty and Error States
5 minAny screen that shows data can be in more than one situation: loading, error, empty (no results) or success. Good React UIs plan for all of them so users never see a blank page ...
Lifecycle and Rendering
5 minA function component goes through three phases: mount (first appears), update (re-renders because state, props or context changed) and unmount (removed). Understanding how React...
StrictMode
4 min<StrictMode> is a development-only wrapper that helps you find bugs early. In development it renders components an extra time and runs each effect's setup and cleanup an extra t...
Accessibility in React
4 minAccessibility (a11y) means everyone can use your app, including people who use a keyboard only, screen readers or high zoom. Most accessibility comes from writing semantic HTML ...
Styling in React
4 minReact does not force a styling method. You can use plain CSS files, CSS Modules (locally scoped class names), inline style objects, utility CSS like Tailwind, or CSS-in-JS libra...
Project Setup with Vite
5 minCreate React App is deprecated; the standard way to start a new React project is Vite, a fast build tool with instant dev server startup and optimized production builds. This to...
Project Architecture
5 minAs a React app grows, a clear folder structure keeps it easy to read and change. There is no official layout; good structures follow a few ideas: group files by feature, keep re...
Reusable Components and Composition
4 minReact favours composition over inheritance: build complex UIs by combining small components and letting parents decide what goes inside through children and props. A good reusab...
React Design Patterns
5 minDesign patterns are proven ways of structuring components and logic. Today the most useful ones are custom hooks (reuse logic), composition (reuse UI), compound components (rela...
DevTools and Debugging
5 minDebugging React means finding out why the UI differs from what you expect. Your tools are the browser console, the React Developer Tools extension (Components and Profiler tabs)...
Testing React
5 minTests prove that components behave correctly and keep working after changes. The modern approach uses Vitest (or Jest) as the test runner and React Testing Library to render com...
CRUD in React
6 minCRUD stands for Create, Read, Update, Delete, the four actions almost every data-driven interface needs. In React you keep the list in state, call an API (or a mock like json-se...
Modern React (React 19)
6 minReact 19 made common tasks simpler: forms can use Actions, pending/optimistic UI have dedicated hooks, ref is a normal prop, and a use API reads promises and context. The React ...
Professional React Practices
5 minProfessional React code is not about clever tricks; it is about clear, predictable, maintainable code. This topic collects the habits that separate a beginner project from produ...