← React Beginner Questions - Set 11 Q103
What is the purpose of React’s useEffect hook?
React Beginner Questions - Set 11
Example
1
useEffect(() => { subscribe(id); return () => unsubscribe(id); }, [id]);
What to notice
- Runs after commit, re-runs on dependency change, cleans up before the next run.
← Back to the question list