# How to repeat displaying something in JSX

> Learn how to repeat something in JSX, like rendering a number of stars from a rating value, using the [...Array(n)].map() spread array trick.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2022-07-14 | Topics: [React](https://flaviocopes.com/tags/react/) | Canonical: https://flaviocopes.com/repeat-something-jsx/

I had the need to repeat something in JSX.

The use case was this, I had a review expressed from 1 to 5 and based on the value I wanted to display some stars, from 1 to 5 stars.

So I used this snippet:

```js
<p>
{[...Array(rating)].map(() => '⭐️ ')}
</p>
```
