Rule React

Effect Cleanup

Always return cleanup functions from useEffect for subscriptions

reacthooksmemory-leaks
CLAUDE.md

Always return cleanup functions from useEffect when setting up subscriptions, timers, or event listeners. Cleanup runs when the component unmounts or before the effect re-runs, preventing memory leaks.

Copy this block into your CLAUDE.md or agent config file to enforce it in your workflow.

get crystl