ForgeFrontend — Prepare, Practice, Crack
Secure checkout
Lifetime access
Instant Drive delivery
Free updates forever

Prepare · Practice · Crack

When should you lift state up, and what is derived state?

Quick answer

Lift state to the closest common parent when siblings need to share it. Derived state is data you can compute from existing state/props — don't store it.

In detail

If two components need the same data, move it to their nearest shared ancestor and pass it down with callbacks. Avoid duplicating data in state — anything you can compute during render (a filtered list, a total, a fullName) should be derived, not stored, so it can never drift out of sync.

// derived — compute, don't store
const total = items.reduce((s, i) => s + i.price, 0);
const active = items.filter(i => !i.done);

💡Principle

Single source of truth: every piece of data lives in exactly one place.

Why interviewers ask this: Tests judgement about state design, not just syntax.

This is 1 of 118+ questions in the React Interview Kit

Get every question with detailed answers, follow-ups and real code — plus coding challenges and a last-minute revision sheet. One-time payment, instant access.

⚡ Get the React Interview Kit → ₹399

Full kit

React Interview Kit · ₹399

Get it →