Explain React useEffect code
Paste a React component and Vibe explains what its useEffect does: when it runs, what the dependency array changes and what the cleanup function stops.
Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.
Vibe25 lines selected
Press Explain it for the sample, or paste your own code first.
What this React useEffect sample shows
- when it runs
- React runs the effect after the component is on screen, not while it renders. The first render showed
Loading...and sent 1 request, to/api/users/1; when the reply came, the heading changed toAna. - the dependency array
[userId]tells React to run the effect again only whenuserIdchanges: changing it from 1 to 2 sent a second request. With[], the effect ran once, so after the prop became 2 the page still showedAna. With no array at all, it ran after every render. Each reply set the user, which rendered and ran the effect, and the effect'ssetUser(null)rendered and ran it once more: 5 replies led to 11 requests, and after the 5th the page showedLoading...again.- cleanup
- The function the effect returns runs before the effect runs again, and when the component is removed. Here it calls
controller.abort(): switching from user 1 to 2 aborted the request for 1, and so did removing the component before the reply. An abortedfetchrejects with anAbortError, which thecatchignores on purpose. - StrictMode
- Inside
<StrictMode>, React's development build ran the effect, its cleanup and then the effect again on the first render: 2 requests for user 1, the first one aborted, and the page still ended onAna. React does this only in development, to show up effects that don't clean up after themselves.
Good to know
- Run with React 19.3.1 and react-dom 19.3.1 in jsdom 29.1.1 on Node 25.7.0, with a stand-in
fetchwhose replies were sent by hand, so the order they arrived in could be chosen. - A 404 reply resolves the
fetchlike any other, so theres.okcheck is what turns it into an error: the page showedCouldn't load: HTTP 404. setUser(null)andsetError(null)at the start of the effect clear the last user's name or error. With user 1 loaded, switching to 2 showedLoading...once the effect ran, thenSamwhen 2 replied.
Watch out: Without the cleanup, a slow reply can overwrite a newer one. With the return () => controller.abort(); line taken out, the page switched from user 1 to 2, showed Sam when 2 replied, then went back to Ana when the late reply for 1 arrived. With the line in, request 1 was aborted and the page stayed on Sam.
Explain React useEffect code beside your editor
Unvibe is a free app for Mac and Windows. In the app there is no pasting: select code in any app and press Control+U (Ctrl+Alt+U on Windows).
Install on Mac
curl -fsSL https://unvibe.site/install.sh | bashPaste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.
Or download the .dmg · Intel Mac build · SHA-256 checksums
Opening the .dmg the first time
- Open the .dmg and drag Unvibe to Applications.
- Open it once; macOS says it can't verify it. Click Done.

Real screen, macOS 15 - System Settings › Privacy & Security › Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.

Real screen, macOS 15
The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open