A practical reference that cuts through the noise about when Effects are actually necessary versus when you're reaching for the wrong tool. It's structured around a clear decision tree: user interactions belong in event handlers, derived values should be calculated during render, and Effects are for synchronizing with external systems. The quick reference table alone will save you from common mistakes like using Effects for transformations or event responses. What makes this genuinely useful is that it teaches you to identify the anti-patterns before you write them, which is more valuable than just knowing the API. Keep it handy during code reviews.

skills.sh installs
4.1K
GitHub stars
2.7K
last updated
Aug 21, 2026

Install

$ npx -y skills add softaworks/agent-toolkit --skill react-useeffect --agent claude-code

Installs into .claude/skills of the current project.

Files

You Might Not Need an Effect

Effects are an escape hatch from React. They let you synchronize with external systems. If there is no external system involved, you shouldn't need an Effect.

Quick Reference

SituationDON'TDO
Derived state from props/stateuseState + useEffectCalculate during render
Expensive calculationsuseEffect to cacheuseMemo
Reset state on prop changeuseEffect with setStatekey prop
User event responsesuseEffect watching stateEvent handler directly
Notify parent of changesuseEffect calling onChangeCall in event handler
Fetch datauseEffect without cleanupuseEffect with cleanup OR framework

When You DO Need Effects

  • Synchronizing with external systems (non-React widgets, browser APIs)
  • Subscriptions to external stores (use useSyncExternalStore when possible)
  • Analytics/logging that runs because component displayed
  • Data fetching with proper cleanup (or use framework's built-in mechanism)

When You DON'T Need Effects

Sponsors

Details

Repository
github.com/softaworks/agent-toolkit
Categories
Frontend Development, Documentation, AI & Agent Building

More from softaworks/agent-toolkit

All 43
1forcedotcom avatargenerating-ui-bundle-metadataforcedotcom/sf-skillsMUST activate when the project contains a uiBundles/*/src/ directory and scaffolding a new UI bundle or app, or when editing ui-bundle.json, .uibundle-meta.xml,3.7Kskills.sh installs
2forcedotcom avatargenerating-ui-bundle-featuresforcedotcom/sf-skillsMUST activate when the project contains a uiBundles/*/src/ directory and the user wants to add authentication or search to their app. Use this skill when adding3.7Kskills.sh installs
3forcedotcom avatardeploying-ui-bundleforcedotcom/sf-skillsMUST activate when the project contains a uiBundles/*/src/ directory or sfdx-project.json and the task involves deploying, pushing to an org, or post-deploy set3.6Kskills.sh installs
4forcedotcom avatarusing-ui-bundle-salesforce-dataforcedotcom/sf-skillsMUST activate when the project contains a uiBundles/*/src/ directory and the task involves ANY Salesforce record operation — reading, creating, updating, or del3.6Kskills.sh installs
5leonxlnx avatarimage-taste-frontendleonxlnx/taste-skillElite website image-to-code skill for Codex. For visually important web tasks, it must first generate the design image(s) itself, deeply analyze them, then impl3.6Kskills.sh installs
6forcedotcom avatarimplementing-ui-bundle-file-uploadforcedotcom/sf-skillsMUST activate when the project contains a uiBundles/*/src/ directory and the task involves uploading, attaching, or dropping files. Use this skill when adding f3.5Kskills.sh installs