Learn Everything

Module · Frontend Engineer

State & Data Fetching

Server state in the cache, client state in the store, and the rest in the URL.

2 topics4 interactive tasks

TOPIC 01

Server State

The data lives on the server - the cache is just a copy of it.

What you'll practice

  • Name a Query and Its Cache Key — guided · beginner
  • Invalidate After a Mutation — practice · intermediate

A command you'll meet

cat ~/frontend/src/api/orders.ts

The cache key is the identity of the request. Open the task below for the full walkthrough.

TOPIC 02

Client State

A small store for shared state, and the URL for the state that should be shareable.

What you'll practice

  • Build a Small Shared Store — practice · intermediate
  • Put Filter State in the URL — challenge · advanced

A command you'll meet

cat ~/frontend/src/store/cart.ts

If a state is worth sharing, it is worth a store. Open the task below for the full walkthrough.