Course contentsShow
← JavaScript
Lesson 2145 of 2,72344. Reactive PatternsFree lesson

When Simple Callbacks or Promises Are Better

Recognize scenarios where reactive patterns add unnecessary complexity compared to straightforward imperative code.

When Simple Callbacks or Promises Are Better

You'll learn: How to recognize when reactive patterns like Observables or Signals introduce unnecessary complexity compared to straightforward async code.

The Simplicity Principle

Not every asynchronous operation benefits from reactive patterns. Sometimes a simple callback or Promise is clearer, easier to maintain, and perfectly sufficient for the task at hand.

Reactive patterns shine when you have continuous streams of events, multiple dependent computations, or complex state synchronization. But for one-off operations or simple request-response patterns, they're often overkill.

When Callbacks or Promises Win

Single asynchronous operations are best handled with Promises:

  • Fetching user profile data once
  • Saving a form submission
  • Loading a configuration file at startup

These don't need subscription management, dependency tracking, or stream operators. A simple await fetch() is more readable than wrapping it in an Observable just to use it once.

Simple event handlers work fine with callbacks:

  • A single button click that triggers one action
  • A one-time initialization listener
  • Basic form validation on submit

If you're not composing multiple events, transforming streams, or managing complex timing logic, a plain event listener is clearer than creating Subjects or Observables.

The Complexity Cost

Reactive patterns introduce concepts like subscription lifecycle, operator chains, and multicasting. These add mental overhead. If your team needs to learn RxJS just to understand a simple API call, you've made the wrong choice.

Key Takeaway: Use Promises for one-off async operations and simple callbacks for straightforward event handling. Reserve reactive patterns for scenarios with continuous data streams, multiple dependencies, or complex event composition—otherwise, you're trading simplicity for unnecessary abstraction.