Back to all articles
Frontend

Not Everything Needs Redux: A Practical Guide to React State Management

Before reaching for Redux or Zustand, React gives you custom hooks, composition, and the trigger pattern — enough to handle most state needs with less boilerplate and more clarity. Here's when each approach earns its place.

9 min readSamson Ameh
#React#State Management#Redux#Hooks#Architecture

Not Everything Needs Redux: A Practical Guide to React State Management

At some point in almost every React project, someone says "let's just add Redux." Usually it happens when a piece of state needs to be shared between two components that aren't close to each other, or when prop drilling gets frustrating enough that it feels like a structural problem.

Sometimes that instinct is right. Often it isn't.

The gap between "this is getting messy" and "this needs a state management library" is wider than people assume. React's built-in tools — hooks, composition, and component architecture — handle a lot more ground than they get credit for. This post is about understanding where that ground ends, and when to actually reach for something heavier.


Start with the right question

Before adding any state, ask: who actually needs this state?

  • If only one component needs it: useState inside that component
  • If a component and its direct children need it: useState lifted to the parent, props down
  • If a whole feature needs it but nothing outside it: a custom hook
  • If the whole app needs it (auth, theme, language): Context, or a library
  • If the state is complex, frequently updated, or needs DevTools: Redux, Zustand, Jotai

Most state in a typical app falls in the first three categories. Libraries live in the last two.


Pattern 1: Custom hooks for encapsulated feature state

The single most underused pattern in React is the custom hook. When a feature has its own internal state — a modal's open/close state, its form inputs, its validation — a custom hook wraps all of it in one place.

Here's a real example. A modal that lets you deactivate a farmer account has three pieces of state: whether it's open, the reason text, and a confirmation checkbox. Without a custom hook, that state either lives in the parent (which doesn't need to know about it) or gets scattered across the modal component.

typescript
// hooks/useDeactivateFarmer.ts
export const useDeactivateFarmer = () => {
  const [open, setOpen] = useState(false);
  const [reason, setReason] = useState("");
  const [confirmed, setConfirmed] = useState(false);

  const canSubmit = reason.trim().length > 0 && confirmed;

  const close = () => {
    setOpen(false);
    setReason("");
    setConfirmed(false);
  };

  const handleDeactivate = () => {
    if (!canSubmit) return;
    // submit logic here
    close();
  };

  return {
    open, setOpen,
    reason, setReason,
    confirmed, setConfirmed,
    canSubmit, close, handleDeactivate,
  };
};

The modal component now just calls this hook and renders:

typescript
const DeactivateFarmerModal = ({ trigger }: { trigger: ReactNode }) => {
  const {
    open, setOpen, reason, setReason,
    confirmed, setConfirmed, handleDeactivate, close,
  } = useDeactivateFarmer();

  return (
    <ModalWrapper
      trigger={trigger}
      open={open}
      onOpenChange={(next) => next ? setOpen(true) : close()}
    >
      {/* form content */}
    </ModalWrapper>
  );
};

Notice what the parent doesn't need to know about: the open state, the reason, the confirmation, or any of the logic. The hook and modal are self-contained. The parent just decides when and where to render the modal.

What this gives you:

  • The state is colocated with the component that uses it
  • Easy to test the hook in isolation
  • The logic is reusable if you ever need the same modal elsewhere
  • No global store touched

Pattern 2: The trigger pattern — composing away prop drilling

Prop drilling usually starts like this: a parent needs to open a modal, so it holds the open state, passes isOpen down to the modal, passes onClose down, passes whatever data the modal needs, and suddenly three components in the middle are holding props they never use.

The trigger pattern solves this by inverting who controls the open state. Instead of the parent managing open/close and passing it down, the modal manages its own open state internally, and the parent simply passes a trigger element — whatever element should open the modal when clicked.

typescript
// Parent doesn't hold any modal state
const FarmerActionsMenu = () => (
  <DropdownMenu>
    <DeactivateFarmerModal
      trigger={
        <button className="w-full text-left px-4 py-2.5">
          Deactivate User
        </button>
      }
    />
    <DeactivateFarmerModal
      trigger={
        <Button variant="outline" className="w-full border-error-base">
          Deactivate Account
        </Button>
      }
    />
  </DropdownMenu>
);

The trigger can be any element — a button, a menu item, an icon, a link. The modal wraps it and attaches the open handler internally. The parent is completely out of the state management loop.

What this gives you:

  • Zero modal state in the parent
  • Flexible trigger implementations — same modal, different triggers in different contexts
  • Clear separation: the parent decides where the modal goes, the modal decides how it works
  • Composable — you can nest these patterns safely

Pattern 3: Avoiding prop drilling with composition

The classic prop drilling problem looks like this:

typescript
// Anti-pattern: props cascading through levels that don't need them
<PageLayout
  isOpen={isOpen}
  onOpen={onOpen}
  onClose={onClose}
  data={data}
  onSubmit={onSubmit}
>
  <Section
    isOpen={isOpen}
    onOpen={onOpen}
    onClose={onClose}
    data={data}
    onSubmit={onSubmit}
  >
    <ActualComponent
      isOpen={isOpen}
      onOpen={onOpen}
      onClose={onClose}
      data={data}
      onSubmit={onSubmit}
    />
  </Section>
</PageLayout>

PageLayout and Section don't use any of these props. They're just pipes.

The fix isn't always Context — it's often just moving state down and letting components own their own behavior:

typescript
const PageLayout = () => (
  <>
    <Section />
    {/* Modal owns its state via hook — parent holds nothing */}
    <DeactivateFarmerModal trigger={<Button>Deactivate</Button>} />
  </>
);

The pattern: push state as close to where it's used as possible, and use the trigger pattern or hooks to avoid passing it up and back down again.


Pattern 4: Folder structure that reflects this thinking

Feature-based folder structure makes this approach scalable. Colocate hooks with the components that use them:

farmer-details/
├── cards/
│   ├── QrCodeCard.tsx
│   ├── EquipmentCard.tsx
│   ├── FarmerProfile.tsx
│   └── index.ts
├── hooks/
│   ├── useDeactivateFarmer.ts
│   └── index.ts
├── FarmerHeader.tsx
├── FarmLocationMap.tsx
├── DeactivateFarmerModal.tsx
└── index.ts

The useDeactivateFarmer hook lives next to the modal that uses it. If you ever move or extract this feature, you take the hook with it and nothing breaks. The feature is self-contained.

Contrast this with putting all hooks in a top-level /hooks folder — that folder becomes a graveyard of loosely related logic with no clear owner.


When you actually need a state management library

Custom hooks and composition aren't a replacement for everything. Here's where they fall short, and what to reach for instead:

Global state shared across the whole app

Authentication status, the current user, theme, language. These are genuinely global — any component in the tree might need them. This is a legitimate use of React Context, or a library like Zustand (lightweight) or Redux Toolkit (more structured, better DevTools).

Complex state transitions

Multi-step workflows where the current state strictly determines what transitions are valid — think a form wizard with branching logic, or a document approval flow. Libraries like XState model this explicitly and make illegal states impossible.

Performance-critical normalized data

If you have a large list of items and multiple components displaying different subsets, normalizing that data in a Redux store with selectors prevents unnecessary re-renders. useState with the full array doesn't give you that control.

Cross-tab state sync

If state needs to persist across browser tabs or survive a refresh in a specific way, you're beyond the scope of component state. Redux Persist, Zustand's persist middleware, or a proper server state library like TanStack Query are the right tools.

Server state

This is worth separating out: data that comes from an API isn't really "state" in the React sense — it's a cache. TanStack Query (React Query) is built for this and handles loading, error, caching, and revalidation better than anything you'd build yourself with useState + useEffect.


The comparison

Custom Hooks + CompositionState Management Library
SetupNoneConfig, boilerplate, providers
Learning curveStandard React patternsLibrary-specific concepts
Bundle sizeZero additionVaries (Zustand ~1KB, Redux larger)
DebuggingReact DevToolsLibrary DevTools (excellent for Redux)
Best forFeature-scoped stateApp-wide or complex state
MaintenanceLess abstraction to manageRequires discipline and conventions

The rules of thumb

Use useState locally when:

  • Only one component needs the state
  • The state is simple (open/close, form input, loading flag)

Use a custom hook when:

  • A feature has multiple related pieces of state
  • Logic needs to be reused across components
  • You want to test the logic separately from the UI

Use the trigger pattern when:

  • A component (modal, drawer, popover) manages its own open state
  • You want to avoid passing open/close props through parent components

Use Context when:

  • State is genuinely global (auth, theme) but doesn't change often
  • Avoid Context for high-frequency updates — it re-renders all consumers

Use a library (Zustand, Redux Toolkit) when:

  • State is shared across many unrelated components
  • You need time-travel debugging or strict state transition rules
  • You have complex async workflows or normalized data

The underlying principle

The question isn't "should I use Redux?" The question is "what's the smallest scope this state can live in?"

State that can live in a component should stay there. State that belongs to a feature should live in a custom hook colocated with that feature. State that's truly global should be global — but most state isn't truly global.

Adding a state management library to manage modal open/close state is like hiring a logistics company to move a box across a room. The machinery exists for a reason, but this isn't the job it's built for.


Resources

Samson Ameh

Written by

Samson Ameh

Frontend Engineer specialising in React, TypeScript, and enterprise UI systems. Based in Lagos, Nigeria.