Loading lesson…
Level 1 · Apprentice0 XP
Pull logic out of components so it can be reused and tested on its own.
Step 1 / 5
ProblemThree screens each fetch a user, track loading and handle errors with the same ten lines. A bug fix means editing three files.
← → step
Before this: Effects
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Write useToggle(initial) that returns [value, toggle], and useLocalStorage(key, initial) that keeps a value in localStorage. Use both in a small 'dark mode' switch.