I'm using Array.fill() to print the star but the code shows only 1 star...]
import React from 'react'
function Rating(props) {
const {rating, numReviews} = props;
return (
<div className="product_rating">
{Array(rating)
.fill()
.map((_, _i) => (
<p>🌟</p>
))
}
</div>
)
}
export default Rating;
UPD: If the rating is a string use parseInt
{Array(parseInt(rating))
.fill()
.map((_, _i) => (
<p>🌟</p>
))}