React: Select Input Options

Date: 2021-03-29
import React from "react";

export interface IOption
{
    label: string;
    value: any;
}

interface SelectProps {
    label: string;
    name: string;
    value?: any;
    options: IOption[];
    onChange: (value: any) => void
}
const value = event.target.value;
export function Select(props: SelectProps) {
    return (
        <label>
            <span className="field">{props.label}</span>
            <select
                name={props.name}
                value={props.value}
                placeholder={props.label}
                onChange={(ev) => props.handleChange(ev.)}>
                {props.options.map((o, i) => <option key={i} value={o.value}>{o.label}</option>)}
            </select>
        </label>
    );
}
47920cookie-checkReact: Select Input Options