← Zettabyte Interview Insights

Zettabyte·Frontend Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Technical screen at Zettabyte for a frontend role. The whole conversation basically revolved around state management, specifically how Zustand and TanStack Query fit together, which sounds narrow but they went pretty deep on it.

Questions Asked (4)

Q1

What is Zustand and what kind of state is it suited for in a React app?

Technical Trade-offsSystem Design
Author's notes

Pretty straightforward to open with.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining Zustand as a lightweight, hook-based state management library for React, then explain its core design and contrast it with alternatives like Redux and Context. Finally, describe the types of state it excels at managing, such as global client state with frequent updates, and give concrete examples.

Pro tip: Emphasize Zustand's selective subscription model that minimizes re-renders, and mention that it can be used outside React components, which is useful for sharing state with non-React code or server-side logic.

1. Define Zustand

State that Zustand is a small, fast, and scalable state management library for React, built on hooks and a centralized store with a simple API.

2. Explain core mechanics

Describe how it uses a single store, selectors for fine-grained subscriptions, and avoids boilerplate and context providers.

3. Compare with alternatives

Contrast with Redux (less boilerplate, no actions/reducers) and Context (better performance for frequent updates, no provider nesting).

4. Identify suitable state types

List state types: global UI state (theme, modals), user session, shopping cart, and any state shared across many components with frequent updates.

5. Provide examples and trade-offs

Give a concrete example (e.g., managing a todo list or auth state) and mention when not to use it (e.g., very simple local state or server cache).

Key Points to Mention

  • Zustand is a lightweight, hook-based state management library with a minimal API.
  • It uses a single store and selectors to optimize re-renders.
  • It avoids boilerplate and context providers, unlike Redux and Context.
  • Suited for global client state that changes frequently and is shared across components.
  • Can be used outside React components, enabling integration with non-React code.
  • Not ideal for server state caching (use React Query) or very simple local state.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How does TanStack Query differ from a client state manager like Zustand?

Technical Trade-offsSystem Design
Author's notes

This is where I had to be careful not to just list features.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying that TanStack Query is a server-state management library while Zustand is a client-state management library, then explain the core differences in purpose, data lifecycle, and caching. Use concrete examples to illustrate when to use each and how they can complement each other in a real application.

Pro tip: Emphasize that TanStack Query handles asynchronous server state with built-in caching, background refetching, and stale-while-revalidate, whereas Zustand is for synchronous client state that doesn't need server synchronization. Mention that using both together is a common and powerful pattern.

1. Define the problem each solves

Explain that TanStack Query manages server state (data fetched from APIs) with caching, synchronization, and updates, while Zustand manages client state (UI state, user preferences) that lives only in the browser.

2. Compare key features

Highlight TanStack Query's features like automatic caching, background refetching, stale-while-revalidate, pagination, and optimistic updates. Contrast with Zustand's simple store, actions, and middleware for global client state.

3. Discuss data lifecycle and synchronization

Explain that TanStack Query handles the full lifecycle of asynchronous data including loading, error, and success states, and keeps data in sync with the server. Zustand does not handle async data fetching or caching out of the box.

4. Address trade-offs and use cases

Discuss when to use each: TanStack Query for server data, Zustand for client-only state. Mention that using Zustand for server data leads to manual caching and synchronization, which is error-prone.

5. Show how they complement each other

Explain that in a real app, you often use both: TanStack Query for server state and Zustand for client state, and they can be integrated (e.g., using Zustand to store UI state that triggers queries).

Key Points to Mention

  • Server state vs client state distinction
  • TanStack Query's built-in caching, background refetching, and stale-while-revalidate
  • Zustand's lightweight, unopinionated store for client state
  • TanStack Query handles async data lifecycle (loading, error, success) automatically
  • Zustand requires manual implementation for async data fetching and caching
  • Common pattern: use both together for optimal state management

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

What's the problem with storing fetched server data inside a Zustand store?

Technical Trade-offsRoot Cause Analysis
Author's notes

Knew this one cold because I've actually done it and regretted it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Acknowledge that while Zustand can store server data, it's not designed for it, leading to issues like stale data, duplication, and increased complexity. Explain that server state is fundamentally different from client state and should be managed with dedicated tools like React Query or SWR. Conclude by highlighting the trade-offs and when it might be acceptable.

Pro tip: Mention that mixing server and client state in Zustand often leads to synchronization bugs and unnecessary re-renders, and that using a server-state library can drastically simplify data fetching logic.

1. Define server state vs client state

Clarify that server state is asynchronous, shared, and can become stale, while client state is synchronous and local to the UI.

2. Identify problems with storing server data in Zustand

List issues such as stale data, manual cache invalidation, duplicated fetching logic, and increased store complexity.

3. Explain why Zustand is not ideal for server state

Zustand lacks built-in features like caching, deduping, background refetching, and optimistic updates that are essential for server state.

4. Recommend alternative solutions

Suggest using dedicated server-state libraries like React Query, SWR, or RTK Query that handle caching, synchronization, and lifecycle automatically.

5. Discuss trade-offs and when it might be acceptable

Acknowledge that for simple apps or static data, Zustand might suffice, but for complex apps, separation of concerns is better.

Key Points to Mention

  • Server state is asynchronous and shared, requiring caching and synchronization.
  • Zustand is a client-state management library, not designed for server state.
  • Storing server data in Zustand leads to stale data and manual cache invalidation.
  • Duplication of server data across components and stores increases memory usage.
  • Lack of built-in features like deduping, retries, and background refetching.
  • Dedicated libraries like React Query or SWR handle server state more efficiently.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Can you describe a scenario where you'd use both Zustand and TanStack Query together in the same feature?

System DesignTechnical Trade-offsAPI & Integrations
Author's notes

The example I gave was a filter panel where the selected filters live in Zustand, and those filter values get passed as part of the query key to TanStack Query.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Pick a concrete feature like a product list with filters, and explain how TanStack Query handles server state (fetching, caching, syncing) while Zustand manages client state (UI filters, selected items). Emphasize the separation of concerns and how they complement each other without overlap.

Pro tip: Mention that you avoid duplicating server data in Zustand—keep it as the single source of truth in TanStack Query—and use Zustand only for ephemeral UI state. This shows you understand the pitfalls of state duplication and cache invalidation.

1. Choose a concrete feature

Select a feature like a dashboard with a list of items and filters, where server data and UI state coexist.

2. Define responsibilities

Assign TanStack Query to fetch, cache, and synchronize server data; assign Zustand to manage client-side UI state like filters, sorting, and selections.

3. Show integration

Explain how Zustand state (e.g., filter values) becomes part of the query key for TanStack Query, triggering refetches when filters change.

4. Highlight benefits

Discuss how this separation avoids prop drilling, reduces boilerplate, and keeps server and client state in sync without duplication.

5. Address trade-offs

Acknowledge potential complexity, such as coordinating cache invalidation with Zustand updates, and how you mitigate it.

Key Points to Mention

  • Separation of server state (TanStack Query) and client state (Zustand)
  • Using Zustand for UI state like filters, sorting, and selections
  • Passing Zustand state as query keys to TanStack Query for automatic refetching
  • Avoiding duplication of server data in Zustand
  • Leveraging TanStack Query's caching and background updates
  • Handling cache invalidation when client state changes

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.