0
var ListItem = React.createClass({ displayName: "ListItem",
  getInitialState: function () {
    return {fruit: this.props.value.product.fruit, meat: this.props.value.product.meat, vegetable: this.props.value.product.vegetable, total: 0 };
  },



render: function () {
    return (
      React.createElement("tr", null, 
      React.createElement("td", null, React.createElement("input", { type: "text", name: "fruit", value: this.state.fruit, onChange: this.handleChange, placeholder: "fruit" })), 
      React.createElement("td", null, React.createElement("input", { type: "number", name: "meat", value: this.state.meat, onChange: this.handleChange, placeholder: "..." })), 
      React.createElement("td", null, React.createElement("input", { type: "number", name: "vegetable", value: this.state.vegetable, onChange: this.handleChange, placeholder: "..." })), 
      React.createElement("td", { className: "total" }, this.state.total)));
  },

Now I want to change Fruit, Meat and Vegetable to "form" instead of "input" with drop down options so when I click on Fruit I will have drop down options of "apple, banana, strawberry". Meat options will be "pork, beef, lamb" etc...

I've try using

return React.createElement("select", {},
  React.createElement("option", {value: "A"}, "Option A"),
  React.createElement("option", {value: "B"}, "Option B"),
  React.createElement("option", {value: "C"}, "Option C")
);
but it doesn't work :(
2
  • en.reactjs.org/docs/lists-and-keys.html Commented Oct 5, 2021 at 21:24
  • @pepinillo6969 this won't work since I need the options "apple, banana, strawberry" to store a value. each option is storing a value i.e. apple = 1, banana = 2
    – azububu
    Commented Oct 5, 2021 at 23:22

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.