the semantic-ui-react Dropdown object does not accept a name or id attribute, and therefore the change cannot be handled in the same way as other form elements. the docs show this:
import React, { Component } from 'react'
import { Dropdown, Grid, Segment } from 'semantic-ui-react'
const options = [
{ key: 1, text: 'One', value: 1 },
{ key: 2, text: 'Two', value: 2 },
{ key: 3, text: 'Three', value: 3 },
]
export default class DropdownExampleControlled extends Component {
state = {}
handleChange = (e, { value }) => this.setState({ value })
render() {
const { value } = this.state
return (
<Grid columns={2}>
<Grid.Column>
<Dropdown
onChange={this.handleChange}
options={options}
placeholder='Choose an option'
selection
value={value}
/>
</Grid.Column>
<Grid.Column>
<Segment secondary>
<pre>Current value: {value}</pre>
</Segment>
</Grid.Column>
</Grid>
)
}
}
when combining inputs into a single event handler, there's no tidy way to pull out an identifier to update the state for the dropdown. how is this normally handled?
thanks