From 3b0f2c74195d4fb96792afc51b4949086139f9e7 Mon Sep 17 00:00:00 2001 From: Mike Ratcliffe Date: Sat, 12 Oct 2024 22:57:23 +0100 Subject: [PATCH] fix(instructions): react-hooks 02.01 (#239) * fix(instructions): react-hooks 02.01 Exercise `react-hooks/exercises/02.side-effects/01.problem.effects/index.tsx` The current instructions don't make sense... this patch clears things up. * fix(instructions): Explain that react-hooks 02.01 should be broken > in the useEffect callback, subscribe to window's popstate event If a dev knows how to use `useEffect()` this will look like a bug... because it is. Let's explain that this bug is supposed to be here at this point. * Apply suggestions from code review --------- Co-authored-by: Kent C. Dodds --- exercises/02.side-effects/01.problem.effects/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/exercises/02.side-effects/01.problem.effects/index.tsx b/exercises/02.side-effects/01.problem.effects/index.tsx index f6b2315e6..6aba1805b 100644 --- a/exercises/02.side-effects/01.problem.effects/index.tsx +++ b/exercises/02.side-effects/01.problem.effects/index.tsx @@ -19,6 +19,7 @@ function App() { // 🐨 add a useEffect(() => {}, []) call here (we'll talk about that empty array later) // 🐨 in the useEffect callback, subscribe to window's popstate event + // 🦉 if that doesn't make sense to you... don't worry, it's supposed to be broken! We'll fix it next // 🐨 your event handler should call setQuery to getQueryParam() // 📜 https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener