FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Medium

Star Rating

15 mins

Build a Star Rating component in React.

Requirements:

  1. Display a row of star icons (e.g., 5 stars).
  2. Clicking a star sets the rating to that value.
  3. Filled stars indicate the current rating.
  4. Users can change the rating by clicking a different star.
  5. Focus on functionality over styling.
  6. 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