Question · Vibe coding with Claude Code course · Module 4: Instagram clone
Quiz: A Toggle with the Previous Value
How do you toggle the liked state in a single component using the previous value?
Answer options
- liked = !liked
- setLiked((prev) => !prev)
- setLiked(liked)
- setLiked(!prev)
You can check the correct answer by solving this task in the CodeWorlds game.