# Suspense, Error Boundaries and Concurrent Features

> Declarative loading and error states with Suspense and error boundaries, lazy loading, and transitions for responsive UIs. Free notes, key concepts, resources...

Canonical: https://www.internhack.in/roadmaps/tracks/frontend/react-suspense
Last updated: 2026-11-28

Declarative loading and error states with Suspense and error boundaries, lazy loading, and transitions for responsive UIs.

Advanced · about 4 hours · difficulty 4/5

Learn first: [Rendering, Reconciliation and Memoisation](https://www.internhack.in/roadmaps/tracks/frontend/react-rendering)

Modern React lets you describe loading and error states declaratively around parts of the tree rather than scattering `isLoading` checks everywhere.

### Suspense

`<Suspense fallback={<Spinner />}>` shows the fallback while anything inside is **suspended**: waiting on lazily loaded code (`React.lazy`), data from a Suspense-enabled library or framework, or a promise read with `use`. Place boundaries where a loading state makes sense to the user (a panel, a route), not around every component. Nested boundaries let a page reveal progressively.

### Error boundaries

An error boundary catches render errors in its subtree and shows a fallback instead of a blank screen. They are class components under the hood; most apps use the `react-error-boundary` package or their framework's error files. They do not catch errors in event handlers or async code; handle those yourself.

### Transitions

- `useTransition` marks a state update as non-urgent, so typing stays responsive while a heavy tab or list re-renders. You get an `isPending` flag for subtle feedback.
- `useDeferredValue` lets an expensive child lag behind a fast-changing value like a search input.
- Transitions also stop already-visible content from being replaced by a Suspense fallback during navigation.

### React 19 additions

Actions and `useActionState` for form submissions, `useOptimistic` for instant UI feedback, and `use` for reading promises and context.

### Good enough to move on

You can code-split a route with `lazy` and Suspense, wrap a widget in an error boundary with a retry button and keep a filter input responsive with `useTransition`.

## Key concepts

- **Suspense boundaries and fallbacks**
- **React.lazy code splitting**
- **Error boundaries**
- **useTransition**
- **useDeferredValue**
- **use, Actions and useActionState**
- **useOptimistic**

## Mini project

Build a dashboard where each widget loads independently behind its own Suspense boundary and error boundary (with retry), routes are lazy-loaded, and a heavy chart filter uses useTransition.

## Check yourself

Why does an error thrown inside an onClick handler not get caught by an error boundary?

## Free resources

- [Suspense](https://react.dev/reference/react/Suspense) (react.dev)
- [useTransition](https://react.dev/reference/react/useTransition) (react.dev)
- [lazy](https://react.dev/reference/react/lazy) (react.dev)

Previous: [Rendering, Reconciliation and Memoisation](https://www.internhack.in/roadmaps/tracks/frontend/react-rendering) · Next: [React Server Components and Server Actions](https://www.internhack.in/roadmaps/tracks/frontend/react-server-components)

## More in React in Depth

- [Hooks, Refs and State Patterns](https://www.internhack.in/roadmaps/tracks/frontend/react-hooks)
- [Effects and Synchronisation](https://www.internhack.in/roadmaps/tracks/frontend/react-effects)
- [Context and Component Composition](https://www.internhack.in/roadmaps/tracks/frontend/react-context)
- [Rendering, Reconciliation and Memoisation](https://www.internhack.in/roadmaps/tracks/frontend/react-rendering)
- [Suspense, Error Boundaries and Concurrent Features](https://www.internhack.in/roadmaps/tracks/frontend/react-suspense)
- [React Server Components and Server Actions](https://www.internhack.in/roadmaps/tracks/frontend/react-server-components)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Frontend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/frontend)
