Module 37: State Management

Lesson 4 of 5 · 15–25 minutes

Server state is different

🏠The everyday picture

The price list pinned in a shop is a copy of head office's prices. It might be out of date; someone else might have changed the real prices; you need to fetch a fresh copy now and then. Your own notes are different: only you change them.

📘What it really is

🖱️Try it

In your Lesson 1 list, mark everything that will come from the backend once you have one (Module 41 onward). Note which of your Context or reducer state would move into a data-fetching tool.

✅Quick check

Why is a list of enquiries from the server different from "is the menu open"?

Show the answer

It's a copy of data owned by the server: it loads slowly, can fail, can be changed by others and go stale.

What does a tool like TanStack Query take care of?

Show the answer

Loading, errors, caching, sharing data between components, refreshing and retrying.

← PreviousReducers
ProLearners Assist