-
-
Save AltusJVR/f36a878031b5ae728aa40a6eec07ca40 to your computer and use it in GitHub Desktop.
n-times loop in React
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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