interface StarRatingProps { rating: number; onRatingChange: (newRating: number) => void; } const StarRating = ({ rating, onRatingChange }: StarRatingProps) => { return (
{[...Array(5)].map((_, index) => { index += 1; return ( onRatingChange(index)} style={{ color: index <= rating ? 'gold' : 'gray', fontSize: '2rem', cursor: 'pointer' }} > ★ ); })}
); }; export default StarRating;