Skip to content

Instantly share code, notes, and snippets.

@dseg
Created January 27, 2017 06:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dseg/1f13c155fcf7ef8f9f7cc12fa9e39fcd to your computer and use it in GitHub Desktop.
Save dseg/1f13c155fcf7ef8f9f7cc12fa9e39fcd to your computer and use it in GitHub Desktop.
A React Select Snippet
<select>
{
// options が undefined or nullなら、何も出力しない。配列なら選択肢に整形する。
options && Array.isArray(options) && options.map((item : any, idx : number) =>
<option
key={`inq_opt_${idx}`}
value={item.value}>{item.label}</option>)
}
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment