Premium
React Like Button (Toggle + Counter)
Challenge summary
Build a React Like button that toggles between liked/unliked and updates a count. Clicking should add or subtract one based on current state, and the counter must never drop below zero.
What you'll practice
- Render a Like button and a like counter.
- The counter must never go below 0.
- Update button styling based on liked state.
- If the counter is 0, unliking should not make it negative.
- React focus: keep liked/count in state and guard against negative values.
What Premium unlocks
Premium unlocks the runnable workspace, behavioral checks, implementation walkthrough, and edge-case discussion.
Free related practice
Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.