FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Medium

Like Button

10 mins

Build a Like button component that changes its appearance based on its state.

Requirements:

  1. The button should toggle between "Liked" and "Not Liked" states when clicked.
  2. Change the button color or icon to reflect the state.
  3. Maintain the state internally using React hooks.
  4. Focus on functionality over styling.
  5. The component should work out-of-the-box in a live React preview (e.g., CodeSandbox/Sandpack).

Code Editor

React Component

00:00
Loading...

Live Preview

See your React component