Courses / Specialisations & media / Advanced React: State and Data Fetching

₹499Self-paced

Advanced React: State and Data Fetching

Build a React data application with clear state ownership, server-state caching, optimistic updates and regression tests.

  • Who it's for. React developers who know components, hooks and TypeScript basics and want to manage state and fetched data reliably.
  • Before you start. Prerequisite courses: React Fundamentals, TypeScript Programming.
  • 25 to 41 hours of study with practice
  • 9 modules, 48 lessons
  • 3 guided projects and a final project

What you'll learn

  • Model component state as discriminated unions and normalised maps so contradictory or duplicated state cannot exist, and place state with the smallest owner.
  • Connect components to stores outside React with useSyncExternalStore and with Zustand, with narrow selectors and order-independent tests.
  • Implement optimistic updates with rollback and reconciliation, with and without a library, and reason about concurrent writes.
  • Handle slow and failing work with abort signals, error boundaries, Suspense, transitions, deferred values and retry policy.
  • Integrate these into a documented data application with a regression suite proven by seeded defects.

Skills you'll gain

  • State ownership
  • Reducers
  • context
  • External stores
  • a state library
  • Server-state caching
  • Query invalidation
  • Optimistic updates
  • Error
  • loading boundaries
  • Performance profiling
  • Advanced application

Tools you'll use

  • React
  • TypeScript
  • TanStack Query
  • Zustand
  • Vite
  • Vitest with jsdom
  • Testing Library

Details to know

  • Certificate on completionIssued after your final project is reviewed
  • 9 module checkpointsA quiz and a practical task close each module
  • Self-pacedStudy any time; your progress is saved

How every lesson works

Each lesson follows the same four steps, so you always know what comes next.

  1. 01

    Watch & Learn

    A short animated video explains one idea at a time.

  2. 02

    Guided Practice

    Work through an example step by step and check the result.

  3. 03

    Quiz & Challenge

    Short questions check the idea has landed before you move on.

  4. 04

    Mini Project

    Build something useful from a project brief.

Learn at your own pace

This is a self-paced course. There are no live classes and no fixed timetable.

  • Start any timeStudy when it suits you. Lessons are short, so they fit around work or college.
  • Pick up where you left offYour progress is saved to your account.
  • Ask when you're stuckUse Ask Mentor inside the learning platform.

Your path in 4 phases

Each phase ends with something you have built and checked.

  1. 01

    Modules 1 to 3

    State ownership to External stores and a state library

    Model component state so contradictory values cannot exist, decide which component owns each piece, and prove ownership choices with behaviour tests and render counts.

    You build: Guided project “Typed state core for a ticket desk”: A ticket status machine reducer over normalised tickets, shared through split contexts, with frozen-input reducer tests and render-count tests.

  2. 02

    Modules 4 to 6

    Server-state caching to Optimistic updates

    Treat fetched data as a cache with keys, freshness and lifetimes using TanStack Query, and read queries, pages and infinite lists through it with fake-fetch tests.

    You build: Guided project “Cached ticket list with safe writes”: A ticket list and detail on TanStack Query with a key factory, freshness table, targeted invalidation and an optimistic assign action that rolls back.

  3. 03

    Modules 7 to 8

    Error and loading boundaries to Performance profiling

    Handle slow and failing asynchronous work with cancellation, error boundaries, Suspense, transitions, deferred values and retry policy, each verified with controlled promises.

    You build: Guided project “Resilient and measured ticket screens”: Error boundaries with retry, held content on navigation, a retry policy by error type, and render budgets for key interactions.

  4. 04

    Module 9

    Advanced application

    Integrate state modelling, caching, optimistic writes, boundaries and tests into one data application with documented cache boundaries.

    You build: Final project build and trainer-reviewed demonstration (see project).

Full curriculum

9 modules and 48 lessons, 25 to 41 hours of study

01State ownership5 lessons, 2 to 4 hours

Lessons

  • Replace boolean flags with a discriminated status union
  • Normalise nested collections into id-keyed maps
  • Colocate state to stop unrelated components re-rendering
  • Initialise lazily and persist state through a safe custom hook
  • Test stateful components by behaviour and count their renders

After this module you can

  • Refactor a component that holds several booleans into one union-typed state value and show with a test that contradictory combinations can no longer be rendered.
  • Convert a nested array state into a map keyed by id plus an ordered id list, and show that renaming one item replaces one entry while every other entry keeps its object identity.
  • Write a test helper that counts commits with the Profiler and use it with Testing Library queries to assert both what the user sees and how many renders an interaction caused.
02Reducers and context5 lessons, 2 to 4 hours

Lessons

  • Write a reducer with a typed action union
  • Model a workflow as a finite state machine in a reducer
  • Test reducers as pure functions and catch hidden mutation
  • Split state and dispatch into separate contexts behind custom hooks
  • Diagnose context re-render storms with render counts

After this module you can

  • Replace scattered state setters with one pure reducer over a union of typed actions, returning the same state object for no-op actions and throwing on unknown ones.
  • Express an approval workflow as a transition table keyed by state and event so that illegal transitions are ignored, and enumerate every state-event pair in a test.
  • Reproduce a context-driven re-render storm, then fix it with a memoised value, by splitting contexts by change rate, or by passing a slice as a prop, and compare render counts for each fix.
03External stores and a state library5 lessons, 2 to 4 hours

Lessons

  • Subscribe to a hand-written store with useSyncExternalStore
  • Return cached immutable snapshots from getSnapshot
  • Create a Zustand store with actions and selectors
  • Select several values at once with useShallow
  • Reset stores between tests and compare store with context

After this module you can

  • Build a minimal subscribable store and connect a component to it with useSyncExternalStore, proving the component updates on change and unsubscribes on unmount.
  • Make a store whose getSnapshot returns the same value until the data really changes, and diagnose the 'getSnapshot should be cached' failure from a snapshot that builds a new object every call.
  • Reset every store to its initial state after each test so tests are order-independent, then choose between context and a store for a given requirement using render counts as evidence.
04Server-state caching6 lessons, 3 to 4 hours

Lessons

  • Separate server state from client state and read query status
  • Design query keys as dependency lists
  • Predict freshness with staleTime and gcTime
  • Write query functions that throw on HTTP errors and honour the abort signal
  • Paginate with placeholder data and isPlaceholderData
  • Load more with infinite queries and cursors

After this module you can

  • Set up a QueryClient and read a list with useQuery, then explain from a test log the difference between status and fetchStatus across the first load and a background refetch.
  • Write keys that include every variable the query function uses and show with request counts that keys differing only in object property order share one cache entry while array item order matters.
  • Build a Load more list with useInfiniteQuery, an initial page param and a next-page function, guard against overlapping fetches, and render all pages without key collisions.
05Query invalidation5 lessons, 2 to 4 hours

Lessons

  • Invalidate by key prefix, exact match and predicate
  • Run a mutation and invalidate once it settles
  • Write the mutation response straight into the cache
  • Chain dependent queries with the enabled option
  • Control background refetch triggers and avoid refetch storms

After this module you can

  • Choose between prefix, exact and predicate invalidation for a given mutation and verify with request counts which cached queries refetch.
  • Write a useMutation that posts a change, invalidates affected lists in onSettled by returning the promise, and show with a test that the mutation stays pending until the refetch finishes.
  • Show with a test that a stale query refetches on window focus, then disable or tune that trigger for one query and explain the resulting request counts.
06Optimistic updates5 lessons, 2 to 4 hours

Lessons

  • Show optimistic results through the UI using mutation variables
  • Update the cache optimistically with a snapshot for rollback
  • Roll back on failure and reconcile with the server on settle
  • Use useOptimistic with a plain async action
  • Keep concurrent mutations in order and visible

After this module you can

  • Render a temporary pending item from the mutation's variables while a request is in flight, and offer a retry using the same variables after a failure.
  • Write the cache-based optimistic update: cancel outgoing queries, snapshot the cached list, write the new value, and return the snapshot as context for the error handler.
  • Show several in-flight mutations at once with useMutationState and explain, with a test of out-of-order responses, what ordering guarantees React Actions and TanStack mutations do and do not give.
07Error and loading boundaries7 lessons, 3 to 5 hours

Lessons

  • Cancel superseded requests with AbortController
  • Contain render errors with a resettable error boundary
  • Read a cached promise with use inside Suspense
  • Keep visible content with useTransition
  • Lag a heavy view behind typing with useDeferredValue
  • Suspend on queries and reset errors with QueryErrorResetBoundary
  • Set retry policy by error type and test it deterministically

After this module you can

  • Write a fetching hook that aborts the previous request when its input changes and ignores the resulting AbortError, and show with a recorded signal that only the latest request can update state.
  • Write a class error boundary with a fallback and a reset path, and show that it catches a render error but not an error thrown in an event handler or timer.
  • Configure retry counts and delays per query, skip retries for client errors with a function, and make tests deterministic by disabling retries and asserting backoff separately with fake timers.
08Performance profiling5 lessons, 2 to 4 hours

Lessons

  • Measure commits with the Profiler before changing code
  • Stop avoidable child renders with memo and stable props
  • Use useMemo and useCallback only where measurement shows a gain
  • Decide which manual memoisation React Compiler makes unnecessary
  • Turn render budgets into regression tests

After this module you can

  • Record actualDuration and phase for a subtree with the Profiler onRender callback and use them to name the single most expensive update in a scripted interaction.
  • Wrap a child in memo, find the prop that changes identity every render, and stabilise it with a primitive, useMemo or useCallback until the child's render count drops to the planned value.
  • Write tests that assert a render-count budget for each key interaction and show that identical refetched data causes no re-render of a memoised consumer because query results are structurally shared.
09Advanced application5 lessons, 2 to 4 hours

Lessons

  • Specify the app and map its state to owners and cache keys
  • Build the state, reducer and cache layers
  • Compose screens with loading, failure and optimistic flows
  • Write the regression suite with controlled fetch
  • Profile, document cache boundaries and demonstrate

After this module you can

  • Write a one-page specification and a table mapping every piece of state to an owner (local, reducer, store, query cache) and every query to a key, freshness and invalidation rule.
  • Implement the typed data access, query hooks with a key factory, the reducers and stores from the specification, with unit tests for each layer.
  • Measure render budgets, document the cache boundaries and invalidation map in a README, and prepare a trainer-reviewed demonstration with a request-count walkthrough.

What you'll build

3 guided projects along the way, then a final project.

  • Typed state core for a ticket desk

    after module 3
  • Cached ticket list with safe writes

    after module 6
  • Resilient and measured ticket screens

    after module 8

Final project

React data application with cache state boundaries and regression tests. Choose one option: Support-ticket desk; Inventory tracker; Event RSVP board.

What you submit

Source submission: repository or archive with the application, the fake API, the tests and a README, in the learner's own words and structure.

How it's reviewed

Trainer review against the rubric: State modelling; Server state; Writes; Boundaries; Performance; Tests; Demonstration.

Where you'll use it

  • Keep a ticket or inventory list correct after edits by invalidating the right cached queries.
  • Show loading and error states and roll back an optimistic update when the server rejects it.

Roles that use these skills

  • React developer
  • Front-end engineer
  • Full-stack developer

Earn the certificate by building, not watching

  1. Complete the lessons and pass each module checkpoint.
  2. Build your final project and demonstrate it.
  3. OUTLEARN reviews your project and issues your certificate. It is not issued automatically.

Frequently asked questions

What do I need before I start?

Prerequisite courses: React Fundamentals, TypeScript Programming. Comfortable with React function components, props, useState, controlled forms, lists with keys, context basics, effects basics and Testing Library queries (React Fundamentals or equivalent), and with TypeScript types, unions and generics at the level of the earlier course. Not required: any state library, TanStack Query, Suspense or React 19 APIs; these are taught here.

Do I get a certificate?

We do not issue certificates until you successfully build and demonstrate your live project. Module and final assessments are planned; the module pass rule is proposed, not final. Certificates are issued by OUTLEARN staff; nothing is issued automatically.

Where do the labs run?

Every lab runs locally on the learner's machine: Node.js LTS, a Vite React TypeScript project, Vitest with jsdom, @testing-library/react and user-event, and a fake fetch whose promises the test resolves, rejects or aborts on demand. No real network, no credentials, no backend. Library versions are not selected in this plan.

Be first in when Advanced React: State and Data Fetching opens

Email us and we will tell you as soon as enrolment opens.

Notify me when it opens
₹499Opens soon
Notify me