Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AltusJVR/f36a878031b5ae728aa40a6eec07ca40 to your computer and use it in GitHub Desktop.
Save AltusJVR/f36a878031b5ae728aa40a6eec07ca40 to your computer and use it in GitHub Desktop.
n-times loop in React
import React from 'react'
const Stars = ({n}) => {
let stars = []
for (let i = 0; i < n; ++i) {
stars.push(<i className="fa fa-star" key={i}></i>)
}
return (
<div className="Stars">
{stars}
</div>
)
}
export default Stars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment