Skip to main content

Data and State for Frontend Developers

Data and state covers where an app's information lives and how it stays in sync. Server state, such as API results, is cached and refetched with a tool like TanStack Query. Client state, such as an open modal, lives in useState, context or a store. Forms add controlled inputs and validation.

Stage: UI Frameworks · Part of the Frontend Developer roadmap · Last reviewed 19 November 2026

What to learn in Data and State

Data and State interview questions

Why use TanStack Query instead of fetching in useEffect?

It handles caching, deduplicating requests, background refetching, retries, loading and error states for you. A hand-written effect has to cover all that and often leaves race conditions or duplicated calls. Query keys also make invalidation after a mutation straightforward.

What is prop drilling and how do you avoid it?

Prop drilling is passing data through many layers of components that do not use it, just to reach a deep child. You can reduce it with composition, React context, or a state library, but context is best for slow-changing values like theme.

Where Data and State fits in the Frontend Developer roadmap

Data and State belongs to the UI Frameworks stage (beginner level), which takes about 6 hours. Component thinking with React, plus how the alternatives differ.

Back to the full Frontend Developer roadmap