Course map
Stage 1: Foundation
Stage 2: Intermediate
Stage 3: Advanced
Stage 4: Routing and Application Architecture
Stage 5: Specialization (pick ONE)

Part 06 / Topic 2 of 7

useEffect's shape: when it runs, and what it returns

useEffect(setup, dependencies) takes a function to run after React has committed the render to the screen - never during render itself, so it is always safe to touch the DOM or any outside system inside it. The second argument, the dependency array, tells React when to run that function again: on every render if omitted entirely, exactly once (right after the first render) if it is [], or whenever any value listed inside it changes between renders. OrderStatusTab's [orderId, status] means "rerun this effect exactly when orderId or status changes, and not for any other reason" - document.title would otherwise go stale the moment either one changed without the effect noticing.

Done here? The practice set for Part 6 — including the solutions — is on the part page.

Search the guide