Your Sunday, upgraded. Free live AI class · 5 PM ISTReserve your seat
FRONTEND & UX

Keep React State Where the Decision Is Made

Lifting all state to the top, or pushing it all into a global store, makes components harder to change. Place each piece of state with the component that owns the decision, and share it only when two components truly need it.

On this page

The core idea

In React, state belongs to the component that renders it and whose events change it. When two sibling components need the same value, the state moves up to their closest common parent and flows down as props. Moving state higher than that causes the parent and all its children to re-render on every change and couples components that do not care about the value. A good rule is to start with state as low as possible and lift it only when a real need appears.

A practical approach

Step 1

For each piece of state, name the component that changes it and the components that read it.

Step 2

Place the state in the lowest component that contains all of those readers and writers.

Step 3

Pass values down as props and pass callbacks for changes, named after the user's intent such as onFilterChange rather than setState.

Step 4

Derive values during rendering instead of storing them. A filtered list computed from items and a query does not need its own state.

Step 5

Reach for context or a store only for values many distant components read, such as the signed-in user or theme, not for one form's input.

Worked example

A course catalogue keeps the search text, selected category, sort order and the filtered results in a top-level App component, plus a copy of the filtered results in a global store. Typing a letter re-renders the header, footer and sidebar, and the two copies of the results sometimes disagree. Moving the filters into the Catalogue component and computing the results during rendering removes the duplicate state and limits re-renders to the part of the page that changed.

A mistake to avoid

Avoid storing props in state with const [items, setItems] = useState(props.items). The local copy stops updating when the parent's data changes, which creates bugs that appear only after the second navigation.

Try it yourself

Pick one page in a React project and draw its components as a tree. Mark where each piece of state lives and which components read it. Move at least one value lower or remove one derived value from state, then confirm the page still behaves correctly.

Your implementation checklist

  • Each piece of state has one clear owner component
  • State is lifted only to the closest common parent
  • Derived values are computed, not stored
  • Callbacks describe user intent
  • Global stores hold only widely shared values

Share or cite this guide

Innovate with Ajay Editorial (2026-10-07). Keep React State Where the Decision Is Made. https://innovatewithajay.com/blogs/keep-react-state-where-decisions-are-made

Editorial approach, sources and corrections

YOUR NEXT CHAPTER

You have the curiosity.
Let’s turn it into capability.

Start with a practical workshop or bring a specific question to Ajay.

Chat with Ajay