Skip to content

Instantly share code, notes, and snippets.

@LiamChapman
Created June 28, 2019 15:20
Show Gist options
  • Select an option

  • Save LiamChapman/4bb53ac03b0c5a53ae835379a1392b4d to your computer and use it in GitHub Desktop.

Select an option

Save LiamChapman/4bb53ac03b0c5a53ae835379a1392b4d to your computer and use it in GitHub Desktop.
Years Dropdown
return(
<select name="years" id="years">
{ [...Array(40).keys()].map( (i, k) => i > 0 && <option key={ k } value={ i + 1 } selected={ parseInt(value, 10) === ( i + 1 ) }>{ i + 1 } years</option> ) }
</select>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment