Skip to content

Commit

Permalink
fix(instructions): react-hooks 02.01 (#239)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
MikeRatcliffe and kentcdodds authored Oct 12, 2024
1 parent 4d9f475 commit 3b0f2c7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions exercises/02.side-effects/01.problem.effects/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3b0f2c7

Please sign in to comment.