Type something to search...

Reactjs

React Interview Questions Every Developer Should Know

React Interview Questions Every Developer Should Know

React interviews have changed. A few years ago you could get by explaining the Virtual DOM and the difference between class and function components.

Continue Reading
Upgrading to React 19: Breaking Changes and Migration Tips

Upgrading to React 19: Breaking Changes and Migration Tips

React 19 brought Actions, useActionState, useOptimistic, the use hook, ref as a regular prop, and Server Components as a stable feature. It als

Continue Reading
Common React Anti-Patterns and How to Fix Them

Common React Anti-Patterns and How to Fix Them

Most React bugs aren't exotic. They're the same handful of patterns showing up in codebase after codebase: state that duplicates other state, effects

Continue Reading
Building a Chat UI with React and AI Streaming Responses

Building a Chat UI with React and AI Streaming Responses

A language model can take ten or twenty seconds to write a long answer. If your chat UI waits for the whole response before showing anything, users s

Continue Reading
React Server Components Without a Framework: Is It Possible?

React Server Components Without a Framework: Is It Possible?

React Server Components shipped as a stable part of React 19, yet almost every tutorial about them starts with "create a Next.js app." That raises a

Continue Reading
Server-Side Rendering vs Client-Side Rendering in React

Server-Side Rendering vs Client-Side Rendering in React

Open the page source of a typical Vite React app and you'll see almost nothing: an empty div with an ID of root and a script tag. Everything the

Continue Reading
Building Progressive Web Apps with React

Building Progressive Web Apps with React

Your React app works great on a fast office connection. Then someone opens it on a train, the signal drops, and they get the browser's offline dinosa

Continue Reading
Integrating Maps into React Apps with Leaflet

Integrating Maps into React Apps with Leaflet

Store locators, delivery tracking, property listings, event pages: sooner or later most apps need a map. The obvious choice, Google Maps, comes with

Continue Reading
Building a Rich Text Editor in React with Tiptap

Building a Rich Text Editor in React with Tiptap

A plain textarea is fine until someone asks for bold text, headings, bullet lists, or links. At that point you have two bad options: build an edito

Continue Reading
Creating Interactive Charts in React with Recharts

Creating Interactive Charts in React with Recharts

Most dashboards start with a request like "show revenue over the last 30 days." Drawing that with raw SVG means calculating scales, axes, ticks, and

Continue Reading
Building Drag-and-Drop Interfaces with dnd-kit

Building Drag-and-Drop Interfaces with dnd-kit

Drag and drop looks simple until you build it. The native HTML5 drag-and-drop API doesn't work on touch devices, gives you almost no control over the

Continue Reading
Feature-Sliced Design for Large React Codebases

Feature-Sliced Design for Large React Codebases

Large React codebases rarely fail because of one bad component. They fail because nobody can answer simple questions anymore. Where does this new cod

Continue Reading
Folder Structure Best Practices for Scalable React Projects

Folder Structure Best Practices for Scalable React Projects

Every React project starts tidy. There's a components folder, maybe a hooks folder, and you can find anything in seconds. Six months later `compo

Continue Reading
Environment Variables in React Apps Done Right

Environment Variables in React Apps Done Right

Every React app eventually needs values that change between environments: the API URL, an analytics ID, a feature flag. The usual first attempt is to

Continue Reading
Securing React Apps: Preventing XSS and Common Vulnerabilities

Securing React Apps: Preventing XSS and Common Vulnerabilities

React has a reputation for being "safe from XSS," and it's partly earned. Every string you render in JSX is escaped, so a comment containing a script

Continue Reading
Authentication in React with JWT and Refresh Tokens

Authentication in React with JWT and Refresh Tokens

Most JWT tutorials end with localStorage.setItem("token", jwt) and an Authorization header on every request. It works on day one. Then the token

Continue Reading
Pagination Strategies for React Applications

Pagination Strategies for React Applications

Rendering ten thousand rows at once is slow to download, slow to render, and useless to the person looking at it. Every list that can grow needs some

Continue Reading
Building a Search Feature with Debounced API Calls in React

Building a Search Feature with Debounced API Calls in React

A search box that calls the API on every keystroke looks fine in a demo and falls apart in production. Typing "wireless headphones" fires nineteen re

Continue Reading
Real-Time Updates in React with WebSockets

Real-Time Updates in React with WebSockets

A dashboard that only refreshes when the user reloads the page feels broken the moment two people use it at once. One person moves a ticket to "Done,

Continue Reading
Implementing Infinite Scroll in React

Implementing Infinite Scroll in React

Infinite scroll looks simple: when the user nears the bottom of the list, load more. The first version usually listens to the scroll event, compare

Continue Reading
Handling Loading and Error States Elegantly in React

Handling Loading and Error States Elegantly in React

Most React screens are designed for the happy path: the data has arrived, the list has items, and nothing went wrong. Real users see the other states

Continue Reading
Fetching Data in React: fetch, Axios, and Beyond

Fetching Data in React: fetch, Axios, and Beyond

React doesn't come with a data-fetching layer. It renders UI from state, and how that state gets filled from an API is up to you. That freedom is why

Continue Reading
Testing Custom Hooks the Right Way

Testing Custom Hooks the Right Way

Custom hooks are where a lot of React logic ends up: debouncing, fetching, syncing with localStorage, subscribing to browser APIs, managing complex

Continue Reading
End-to-End Testing React Apps with Playwright

End-to-End Testing React Apps with Playwright

Unit and component tests tell you that pieces work. They don't tell you that a user can actually sign up, add something to a cart, and check out in a

Continue Reading
Mocking API Calls in React Tests with MSW

Mocking API Calls in React Tests with MSW

Sooner or later, every React component test runs into the network. The component calls fetch in an effect, or uses TanStack Query, or goes through

Continue Reading
Testing React Components with Vitest and Testing Library

Testing React Components with Vitest and Testing Library

Most React bugs that reach users aren't in complex algorithms. They're a button that stops submitting after a refactor, an error message that never a

Continue Reading
Internationalization in React with react-i18next

Internationalization in React with react-i18next

Translating a React app sounds like a find-and-replace job until you hit the details. "1 items" needs a singular form, and Polish has three plural fo

Continue Reading
Managing Focus and Keyboard Navigation in React

Managing Focus and Keyboard Navigation in React

Open a modal in a typical React app, press Tab a few times, and you'll often find yourself back on the page behind it, clicking links you can't see.

Continue Reading
Accessibility Best Practices for React Developers

Accessibility Best Practices for React Developers

React makes it easy to build interfaces out of anything. A div with an onClick looks and behaves like a button for a mouse user, so it ships. The

Continue Reading
Radix UI Primitives: Accessible Building Blocks for React

Radix UI Primitives: Accessible Building Blocks for React

Building a dropdown menu that looks right takes an afternoon. Building one that works right takes weeks. It needs arrow-key navigation, typeahead, fo

Continue Reading
Getting Started with shadcn/ui in React Projects

Getting Started with shadcn/ui in React Projects

Most component libraries give you a package to install and a theme API to fight with. You want the button slightly rounder, or the dialog to animate

Continue Reading
Building a Reusable Design System with React and Storybook

Building a Reusable Design System with React and Storybook

Most teams don't decide to build a design system. They notice they have four slightly different buttons, three shades of "primary blue," and a modal

Continue Reading
Animations in React with Motion (Framer Motion)

Animations in React with Motion (Framer Motion)

CSS transitions get you far, until you need to animate something leaving the page. React removes the element from the DOM immediately, so there's not

Continue Reading
Building a Dark Mode Toggle in React

Building a Dark Mode Toggle in React

A dark mode toggle looks like a five-minute feature: a boolean in state and a class on the body. Then the bugs show up. The page flashes white before

Continue Reading
Styled Components vs Emotion: A Practical Comparison

Styled Components vs Emotion: A Practical Comparison

If you work on a React app that's more than a few years old, there's a good chance it uses styled-components or Emotion. They were the two dominant C

Continue Reading
Using Tailwind CSS Effectively in React Projects

Using Tailwind CSS Effectively in React Projects

Tailwind is easy to start with and easy to make a mess with. The first few components feel great. Six months later you have 40-class strings copied a

Continue Reading
Styling React Components: CSS Modules vs Tailwind vs CSS-in-JS

Styling React Components: CSS Modules vs Tailwind vs CSS-in-JS

React doesn't tell you how to style components, so every new project starts with the same argument. One developer wants plain CSS files, another want

Continue Reading
forwardRef and useImperativeHandle Explained

forwardRef and useImperativeHandle Explained

You build a nice TextField component that wraps an input with a label and error message. Then someone on your team needs to focus it when a form

Continue Reading
Portals in React: Building Modals, Tooltips, and Toasts

Portals in React: Building Modals, Tooltips, and Toasts

You build a modal inside a card component, open it, and half of it is cut off. The card has overflow: hidden, or a parent has a transform, or som

Continue Reading
Polymorphic Components with the "as" Prop

Polymorphic Components with the "as" Prop

Design systems constantly run into the same small dilemma. You build a Button with the right padding, colors, focus ring, and loading state. Then s

Continue Reading
Building Headless UI Components in React

Building Headless UI Components in React

Every team that builds a component library hits the same wall. The dropdown works perfectly, keyboard navigation, focus management, ARIA attributes a

Continue Reading
The Container/Presentational Pattern in Modern React

The Container/Presentational Pattern in Modern React

You've probably seen a component like this: it fetches data in an effect, tracks loading and error state, handles pagination, formats dates, filters

Continue Reading
Higher-Order Components: Are They Still Relevant?

Higher-Order Components: Are They Still Relevant?

If you open a React codebase that's more than a few years old, you'll probably find exports like `export default withRouter(connect(mapState)(withSty

Continue Reading
Render Props vs Custom Hooks: Evolving React Patterns

Render Props vs Custom Hooks: Evolving React Patterns

Before hooks, sharing stateful logic between React components was awkward. You couldn't call a function that "had state" because only class component

Continue Reading
Compound Components Pattern in React

Compound Components Pattern in React

Every component library eventually builds a Tabs component, and the first version usually looks like this: Tabs with an items prop that takes an

Continue Reading
Discriminated Unions for Type-Safe React Props

Discriminated Unions for Type-Safe React Props

Look at almost any growing component library and you'll find props types like this: href?: string, onClick?: () => void, isLoading?: boolean, `

Continue Reading
Generic Components in React with TypeScript

Generic Components in React with TypeScript

Sooner or later you build a component that works with "some kind of item": a list, a dropdown, a table, an autocomplete. The first version usually ty

Continue Reading
TypeScript with React: Typing Props, State, and Events

TypeScript with React: Typing Props, State, and Events

Most React bugs that TypeScript catches are boring ones: a prop passed as a string instead of a number, a state value that can be null but is used

Continue Reading
Migrating from Create React App to Vite

Migrating from Create React App to Vite

Create React App was the default way to start a React project for years, but it's now officially deprecated. The React team stopped recommending it i

Continue Reading
Building React Apps with Vite: A Fast Modern Setup

Building React Apps with Vite: A Fast Modern Setup

If you've worked on an older React project, you probably remember waiting for the dev server. Starting it took half a minute, and every save took a f

Continue Reading
Image Lazy Loading Techniques for React Apps

Image Lazy Loading Techniques for React Apps

Images are usually the heaviest thing on a page. A product grid with 60 thumbnails, a blog index with a hero image per post, or a photo gallery can e

Continue Reading
Web Workers in React: Offloading Heavy Computation

Web Workers in React: Offloading Heavy Computation

JavaScript in the browser runs on a single main thread, and that thread is also responsible for handling clicks, running React, and painting the scre

Continue Reading
Debouncing and Throttling User Input in React

Debouncing and Throttling User Input in React

Some events fire far more often than you need to respond to them. A user typing "react hooks" into a search box fires eleven onChange events. Scrol

Continue Reading
Optimizing Bundle Size in React Applications

Optimizing Bundle Size in React Applications

Every kilobyte of JavaScript you ship has to be downloaded, parsed, compiled, and executed before your app becomes interactive. On a fast laptop with

Continue Reading
Virtualizing Long Lists with TanStack Virtual

Virtualizing Long Lists with TanStack Virtual

Render 10,000 rows with .map() and React creates 10,000 components, the browser creates tens of thousands of DOM nodes, and the first paint takes s

Continue Reading
Preventing Unnecessary Re-Renders with React.memo

Preventing Unnecessary Re-Renders with React.memo

When a component's state changes, React re-renders that component and every component below it, whether their props changed or not. Most of the time

Continue Reading
Profiling React Apps with React DevTools

Profiling React Apps with React DevTools

Most React performance work goes wrong at the first step. Someone notices the app feels slow, guesses which component is to blame, and wraps half the

Continue Reading
Automatic Batching in React 18 and Beyond

Automatic Batching in React 18 and Beyond

You call three state setters in a row inside a fetch callback and your component renders three times. Worse, the first of those renders shows the n

Continue Reading
Concurrent Rendering in React: What Changed and Why

Concurrent Rendering in React: What Changed and Why

Type into a search box that filters ten thousand rows and, in an older React app, the input freezes. Every keystroke kicks off a render of the whole

Continue Reading
Why Keys Matter When Rendering Lists in React

Why Keys Matter When Rendering Lists in React

Every React developer has seen the console warning: "Each child in a list should have a unique key prop." The quick fix is to add key={index}, the

Continue Reading
React Fiber Architecture Explained Simply

React Fiber Architecture Explained Simply

Type into a search box that filters a list of 10,000 items in an older React app and you can feel the problem. Each keystroke triggers a render, the

Continue Reading
Understanding the Virtual DOM and Reconciliation

Understanding the Virtual DOM and Reconciliation

"React is fast because of the virtual DOM" is one of the most repeated lines in frontend development, and it's only half true. The virtual DOM isn't

Continue Reading
Error Boundaries: Gracefully Handling Crashes in React

Error Boundaries: Gracefully Handling Crashes in React

When a React component throws during rendering and nothing catches it, React unmounts the entire tree. Your users don't see a helpful message. They s

Continue Reading
Suspense for Data Fetching: How It Works Under the Hood

Suspense for Data Fetching: How It Works Under the Hood

Suspense looks like magic the first time you use it for data. A component reads data as if it were already there, with no isLoading flag and no `

Continue Reading
Code Splitting in React with React.lazy and Suspense

Code Splitting in React with React.lazy and Suspense

A single-page app usually ships as one big JavaScript file. Every route, every chart library, every rich text editor, and every admin screen gets dow

Continue Reading
Protected Routes and Authentication Flows in React

Protected Routes and Authentication Flows in React

Every app with accounts eventually needs the same flow. A visitor opens /dashboard, gets sent to the login page, signs in, and lands back on the da

Continue Reading
Nested Routes and Layouts with React Router

Nested Routes and Layouts with React Router

Look at almost any dashboard app and you'll see layers. There's an outer shell with a top bar. Inside it, a settings section with its own sidebar. In

Continue Reading
React Router v7: A Complete Beginner's Guide

React Router v7: A Complete Beginner's Guide

A React app without a router is a single screen. As soon as you need a home page, a product page, and a settings page that each have their own URL, w

Continue Reading
Client-Side Form Validation Patterns in React

Client-Side Form Validation Patterns in React

Most form bugs aren't about sending data. They're about telling the user what's wrong at the right time. Show an error the moment someone types the f

Continue Reading
Handling File Uploads in React with Drag and Drop

Handling File Uploads in React with Drag and Drop

A plain file input works, but it is not a great experience. Users expect to drag files from their desktop onto the page, see thumbnails before anythi

Continue Reading
Formik vs React Hook Form: A Side-by-Side Comparison

Formik vs React Hook Form: A Side-by-Side Comparison

For years, Formik was the default answer to "how do I build forms in React?" It took the tedious parts of controlled forms, like tracking values, tou

Continue Reading
Building Accessible Forms with React Hook Form and Zod

Building Accessible Forms with React Hook Form and Zod

A form can look polished and still be unusable for a large group of people. A screen reader user tabs into an input and hears "edit text" with no ide

Continue Reading
Controlled vs Uncontrolled Components in React Forms

Controlled vs Uncontrolled Components in React Forms

Every form input in React has a value, and something has to own it. Either React holds the value in state and pushes it into the input on every rende

Continue Reading
Derived State in React: Common Mistakes and Better Patterns

Derived State in React: Common Mistakes and Better Patterns

A surprising number of React bugs come from the same root cause: storing a value in state that could have been calculated from other values. A filter

Continue Reading
Managing Server State with TanStack Query

Managing Server State with TanStack Query

Fetching data in React looks simple until you ship it. A useEffect with fetch and two pieces of state works for a demo, then the real questions a

Continue Reading
Recoil vs Jotai: Comparing Atom-Based State Libraries

Recoil vs Jotai: Comparing Atom-Based State Libraries

Recoil introduced many React developers to the idea of atomic state: small, independent pieces of state that components subscribe to individually

Continue Reading
Jotai and Atomic State Management in React

Jotai and Atomic State Management in React

Picture a dashboard where a filter in the sidebar, a chart in the middle, and a summary card in the header all depend on the same few pieces of state

Continue Reading
Zustand: Lightweight State Management for React Apps

Zustand: Lightweight State Management for React Apps

Most React apps reach a point where useState and props stop being enough. A cart count in the header, a sidebar toggle shared across layouts, or a

Continue Reading
RTK Query: Data Fetching and Caching Made Simple

RTK Query: Data Fetching and Caching Made Simple

If you have ever written a Redux slice just to fetch a list of posts, you know the routine: a status field, an error field, a thunk, three reduce

Continue Reading
Getting Started with Redux Toolkit in React

Getting Started with Redux Toolkit in React

Redux has a reputation for boilerplate: action type constants, action creators, switch statements, spread operators nested four levels deep, and a se

Continue Reading
Context API vs Redux: Which One Should You Use?

Context API vs Redux: Which One Should You Use?

"Do I still need Redux now that we have Context?" is one of the most common questions in React. You'll find confident answers on both sides: Context

Continue Reading
Avoiding Prop Drilling with the React Context API

Avoiding Prop Drilling with the React Context API

Your App component knows who the logged-in user is. The avatar that needs that user lives inside Header, inside Navbar, inside UserMenu. So y

Continue Reading
Lifting State Up: Sharing Data Between Sibling Components

Lifting State Up: Sharing Data Between Sibling Components

You've built a search input and a results list as two separate components. Each works on its own, but now the list needs to know what the user typed.

Continue Reading
React Compiler Explained: Automatic Memoization Without the Boilerplate

React Compiler Explained: Automatic Memoization Without the Boilerplate

Every React developer has written code like this: a component re-renders too often, so you wrap a computed value in useMemo, wrap a handler in `use

Continue Reading
useActionState and Form Actions in Modern React

useActionState and Form Actions in Modern React

A typical React form submission used to need a surprising amount of code. You'd call preventDefault(), read every field from state, set an `isSubmi

Continue Reading
useOptimistic: Building Instant-Feeling UIs in React

useOptimistic: Building Instant-Feeling UIs in React

You click a heart icon and nothing happens for 400 milliseconds. Then it fills in. The request succeeded, but the app felt sluggish, and some users c

Continue Reading
useSyncExternalStore: Subscribing to External Data Sources Safely

useSyncExternalStore: Subscribing to External Data Sources Safely

Not all state lives in React. The browser knows whether you're online, how wide the window is, and what's in localStorage. A WebSocket client holds

Continue Reading
useId: Generating Stable IDs for Accessible Components

useId: Generating Stable IDs for Accessible Components

Accessible HTML runs on IDs. A <label> points at its input with htmlFor, an input points at its error message with aria-describedby, and a tab

Continue Reading
useTransition and useDeferredValue for Smoother UIs

useTransition and useDeferredValue for Smoother UIs

You type a letter into a search box and the whole page freezes for half a second. The input lags behind your fingers, characters appear in bursts, an

Continue Reading
Exploring the React use() Hook for Promises and Context

Exploring the React use() Hook for Promises and Context

For years, reading async data in a React component meant the same ritual: a useState for the data, another for loading, another for errors, and a `

Continue Reading
useLayoutEffect vs useEffect: Timing Differences That Matter

useLayoutEffect vs useEffect: Timing Differences That Matter

You build a tooltip that measures its own height and flips above the trigger if there isn't room below. It works, but every time it opens, there's a

Continue Reading
The Rules of Hooks Explained with Real-World Examples

The Rules of Hooks Explained with Real-World Examples

"Rendered more hooks than during the previous render." If you've seen that error, you've broken one of the rules of hooks. It usually happens in code

Continue Reading
Building Your Own Custom Hooks in React

Building Your Own Custom Hooks in React

You write a component that tracks window width with useState, useEffect, and a resize listener. A week later you need the same thing in another c

Continue Reading
useMemo and useCallback: When Memoization Actually Helps

useMemo and useCallback: When Memoization Actually Helps

Open almost any React codebase and you'll find useMemo and useCallback wrapped around things that don't need them: a string concatenation, an inl

Continue Reading
Mastering useRef: Beyond Accessing DOM Elements

Mastering useRef: Beyond Accessing DOM Elements

Most developers meet useRef as "the hook for focusing an input." You attach it to an element, call ref.current.focus(), and move on. That's a fin

Continue Reading
Why Your useEffect Runs Twice in React Strict Mode

Why Your useEffect Runs Twice in React Strict Mode

You add a console.log inside useEffect, open the browser, and see it printed twice. Your API request shows up twice in the Network tab. An analyt

Continue Reading
A Practical Guide to useEffect and Its Dependency Array

A Practical Guide to useEffect and Its Dependency Array

useEffect is the hook people get wrong most often, and the dependency array is usually where it goes wrong. Leave a value out and your effect works

Continue Reading
useState vs useReducer: Choosing the Right State Hook

useState vs useReducer: Choosing the Right State Hook

Every React component that remembers something uses either useState or useReducer. Most of the time useState is the obvious pick: a boolean for

Continue Reading
Understanding the React Component Lifecycle in the Hooks Era

Understanding the React Component Lifecycle in the Hooks Era

If you learned React with class components, you probably remember the lifecycle diagram: componentDidMount, componentDidUpdate, `componentWillUnm

Continue Reading
Micro-Frontends with React: Breaking Down Monoliths into Scalable Components

Micro-Frontends with React: Breaking Down Monoliths into Scalable Components

The micro-frontend architecture allows large applications to be broken down into smaller, more manageable parts. It’s an effective way to manage

Continue Reading