Step 5 of 6
Pointers, allocation and memory leaks
A pointer (or reference) is an address: 'the data lives over there'. Two variables can point to the same object, so changing one changes 'both'. A leak happens when something keeps a reference to memory you'll never use again, so it's never freed.
Why it matters when you build with AI: Classic React bug: mutating state objects in place so the UI doesn't update, or adding event listeners and intervals in useEffect without cleaning them up.
Quick check
const b = a; b.name = 'x'; where a is an object. What is a.name?
a and b point to the same object. Change one, you change 'both'.