Back to feed
Dev.to
Dev.to
7/11/2026
React Approval Emails Without Effect Loops

React Approval Emails Without Effect Loops

Short summary

A practical guide to avoiding duplicate approval emails in React by separating user intent from rendering side effects. The author argues against using useEffect to trigger one-time actions like email sends, since remounts and rehydrations cause replays. The recommended pattern dispatches an approval command with an idempotency key to the server, which owns delivery logic via an outbox pattern.

  • Don't use useEffect to trigger one-time side effects like emails — remounts and rehydrations cause duplicates
  • Dispatch approval commands with idempotency keys; let the server own delivery decisions
  • Outbox pattern ensures crash-safe, retry-safe notification delivery

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more