Back to all skills
Progress1 of 45
AdvancedLow
Store Event Handlers in Refs
Store callbacks in refs when used in effects that shouldn't re-subscribe on callback changes.
advancedhooksrefsevent-handlersoptimization
Code Comparison
•Incorrect (re-subscribes on every render):tsx
•Correct (stable subscription):tsx
•Alternative: use `useEffectEvent` if you're on latest React:tsx
Why This Matters
Impact: stable subscriptions. This optimization is classified as LOW priority for production applications.