score:2

Accepted answer
class Example extends Component {
  constructor(props) {
    super(props);
    this.state = {
      products: [],
    };

    this.selectByProduct = {};
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleSubmit(event, productIndex) {
    event.preventDefault();
    const size = this.selectByProduct[productIndex].value;
    console.log(`you submitted the size ${size} of product ${productIndex}`)
  }

  render() {
    return this.state.products.map((product, i) => (
      <form onSubmit={event => this.handleSubmit(event, i)}>
          <select ref={select => this.selectByProduct[i] = select} name="size" className="form-control" style={{height: '46px;'}}>
            <option key="1" value="1">Red</option>
            <option key="2" value="2">Yellow</option>
            <option key="3" value="3">Green</option>
          </select>
          <input type="submit" value="Pick This" className="form-control" />
      </form>
    ));
  }
}

score:3

<select name="size" onChange={e => this.handleChange(e, i)} className="form-control" style={{height: '46px;'}}>
  <option key="1" value="1">Red</option>
  <option key="2" value="2">Yellow</option>
  <option key="3" value="3">Green</option>
</select>

Related Query

More Query from same tag