Script Valley
React.js: Complete Course
State Management with Zustand and React Query/Assessment

Practice & Assessment

Test your understanding of State Management with Zustand and React Query

Multiple Choice Questions

5
1

Which type of state should be managed with React Query?

2

In Zustand, how do you prevent a component from re-rendering when unrelated store state changes?

3

What happens when two components use the same React Query queryKey?

4

What should you call after a successful mutation to keep the UI in sync with the server?

5

What is wrong with storing API response data in Zustand?

Coding Challenges

1
1

Product Catalog with Filters and Cart

Build a product catalog page. Fetch products from https://fakestoreapi.com/products using React Query's useQuery (queryKey: ['products']). Store active category filter and cart items in a Zustand store. Display products filtered by the selected category. Add-to-cart button calls a Zustand action. A CartSummary component shows item count from Zustand without prop drilling. Show loading and error states from React Query. No mutations needed. Expected output: filterable product list with working cart counter. Estimated time: 30 minutes.

Medium

Mini Project

1

Full-Stack Task Manager Dashboard

Build a task manager using React Query + Zustand. API: use https://jsonplaceholder.typicode.com/todos. Features: fetch all todos with useQuery (paginated โ€” 10 per page), add a todo with useMutation + invalidateQueries, toggle complete with useMutation + optimistic update, store filter (all/active/completed) and current page in Zustand. Components: TaskList, TaskItem, AddTaskForm, FilterBar, PaginationControls. Show loading skeletons during fetch. Show mutation error messages. Handle empty states.

Hard
Practice & Assessment โ€” State Management with Zustand and React Query โ€” React.js: Complete Course โ€” Script Valley โ€” Script Valley