October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Reusing Logic in Predictable State Management: Actions, Reactions, and Use Cases

A practical guide to the Action/Reaction convention: keep narrow state changes reusable, make cross-state consequences visible, and leave caller-specific intent in use cases.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To reuse complicated state-change logic without obscuring what a user flow does, give shared work an explicit scope: use an Action for one side effect that updates one state, and a Reaction when reusable work crosses either boundary. Keep each use case responsible for the particular user intent—such as navigation or screen-specific feedback. These names describe an optional team convention, not a compiler-enforced feature or a Redux requirement.

What Actions and Reactions are meant to clarify

Shared logic can make a codebase easier to maintain, but placing too much behavior behind a generic call can hide the consequences of a user action. The convention described by Mikhail Palei addresses that tension by making the scope of reusable units visible in their names.

As an Amazon Associate I earn from qualifying purchases.

Both Actions and Reactions are ordinary classes. Their labels are a promise to other developers, not rules enforced by a language, framework, or compiler. As Palei puts it, “What you see in the name is what you get” (Palei’s DEV Community article).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When to use an Action

One side effect, one state

An Action is intended to perform one side effect and write to one state. It can make multiple updates to that same state; the boundary is the state it owns, not the number of assignments. Its name should make the work and affected state legible without requiring a reader to discover hidden effects elsewhere.

In Palei’s AddExperienceAction example, the Action marks the viewer state as loading, calls a repository, then stores either the returned experience or a failure in that viewer state. It does not announce anything in chat, alter the wallet, or display a snackbar. The repository call is the side effect; the state updates report its outcome.

Use base classes for mechanics, named classes for intent

Generic base classes can hold repeated workflow mechanics while named subclasses identify a specific operation—for example, GetChatRoomMessagesAction. The article mentions reusable shapes such as GetAction, UpdateAction, and DeleteAction. Reuse should not erase the Action’s narrow contract: one side effect and one state.

When reusable work becomes a Reaction

Crossing the Action boundary

Use a Reaction when shared work has multiple side effects or changes multiple states. Palei’s AwardExperienceReaction calls the experience Action, checks whether the viewer leveled up, fetches unlocked features, updates another state, shows an animation, and tracks analytics. That is more than the focused experience update of an Action, so the broader name signals that a reader should inspect the implementation to understand its full effects.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Separate shared consequences from caller intent

A useful boundary question is: who wants this event to happen? A consequence that should follow the triggering event wherever it occurs can live in a shared Reaction. The particular response to a user in a particular screen or flow usually belongs in that use case. For instance, leveling up may be shared, while navigation and contextual snackbar wording can vary between callers.

This is a convention, not an absolute ban on putting feedback in a Reaction. A team could make a response shared if it genuinely belongs in every relevant flow. The important thing is that the unit’s name and actual contract stay transparent.

How the donation example orders updates and failure handling

The article’s donation flow separates immediate interface changes from work that waits for server confirmation. Its order is specific to that product example:

  1. Announce and optimistically update: add the donation announcement and subtract the amount from the wallet before submitting the request.
  2. Roll back on failure: if submission fails, restore the wallet funds and remove the announcement.
  3. Handle confirmed success: after the server accepts the donation, call the shared experience Reaction and then show a success message.

Palei presents this ordering as a product decision: the wallet should respond instantly, while experience can wait for confirmation. It is not a general rule for optimistic updates, transaction boundaries, or reward timing. A different product may need different ordering and rollback behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How this convention relates to Redux

Actions and Reactions in Palei’s article are named classes for organizing orchestration and state-changing logic. They should not be confused with Redux’s own terminology or treated as required Redux architecture.

  • The Redux Style Guide states, “Reducers must not have side effects,” and recommends Redux Toolkit for writing Redux logic.
  • Redux Toolkit is documented as simplifying store setup, reducers, and immutable updates.
  • Redux’s reusable reducer logic guidance describes patterns such as higher-order reducers and createSlice factories.

Those are Redux-specific rules and APIs. They address reducer logic, middleware, and toolkit patterns; they do not prescribe the Action/Reaction taxonomy. A team can consider the taxonomy as an optional naming convention without presenting it as a Redux rule.

A practical boundary check for a team

  • One side effect and one state: keep the unit an Action, and name it so readers can infer its work and state ownership.
  • A second state or hidden side effect: either rename the unit as a Reaction or move the extra work to the caller if it is specific to that flow.
  • Shared consequence: put it in a Reaction when it should follow the triggering event across callers.
  • Screen-specific response: leave navigation or contextual feedback in the use case that knows the user’s intent.
  • Failure path: make the intended ordering and any rollback behavior explicit, rather than assuming a shared architecture rule will decide them.

The convention’s value depends on teams honoring and reviewing those boundaries. The cited article and Redux documentation do not establish it as an industry standard or provide measured evidence of productivity or defect reductions.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.