I have a Select that get's values from API,
then on change it gets the value from the select and renders a table. but I want the select to display planet.id and planet.name, but doing it using event.target.value wont work since it would pass both values and table wouldn't render!
Any way of doing this passing for example key={planet.id}?
class Planet extends React.Component {
constructor(props) {
super(props);
this.state = {value: 1};
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleChange(event){
this.setState({value: event.target.value});
}
render () {
let planets = this.props.state.planets;
let optionItems = planets.map((planet) =>
<option key={planet.id} >{planet.id}</option>
);
valueproperty in<option>tag?valueproperty to<option>.value