React: getting started

Lesson 06 · 12 min

useEffect: outside the component

An effect is the network, a subscription, the tab title. Not for adding first + last.

useEffect(() => { … }, [deps]) runs after rendering. An empty [] means once after mounting. No array — every render (almost always a mistake). The array holds what the effect reads: otherwise it takes a stale closure.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.