<ul className='rating'>
{Array.from({ length: 10 }, (_, i) => (
<li key={`rating-${i + 1}`}>
<input
type='radio'
id={`num${i + 1}`}
name='rating'
value={i + 1}
onChange={handleChange}
checked={selected === i + 1}
/>
<label htmlFor={`num${i + 1}`}>{i + 1}</label>
</li>
))}
</ul>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter