SpinTheMic
Pro

Interview practice question

Sharing shopping cart state across pages

Frontend Engineering · State Management and Data Fetching · Beginner

The cart icon in the header and the cart page both need the cart's contents. How would you manage this state?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Shared store or context.
  • Server as source of truth for logged-in users.
  • Persist guest carts locally.
  • Update optimistically, sync with server.
  • Selectors for count vs details.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics