Dropdown cascading fetch the selected value
A few things need to be fixed;
- You need to keep a state value for the selected server
selectserver
.
this.state = {
...
selectserver: "",
...
};
- The
routeChange
handler function should updateselectserver
.
routeChange = (e) => {
this.setState({ selectserver: e.target.value });
};
- Server selection need to to
this.state.selectserver
as the value.
<select
value={this.state.selectserver}
onChange={this.routeChange}
>
...
...
</select>
Code Sandbox