this is my function where i have to pass the drop down selected value.
function getsign(sign){
}
this is my react-bootstrap dropdown component i want to pass the selected value to the function .
<DropdownButton id="dropdown-item-button" title="Your Sign" onSelect={getsign(value)} >
<Dropdown.Item as="option" value={'option1'}>Option 1</Dropdown.Item>
<Dropdown.Item as="option" value={'option2'}>Option 2</Dropdown.Item>
CodePudding user response:
You have to get the e.target.value from the dropdown button. Hope from this console you will get the value from dropdowns
<DropdownButton id="dropdown-basic-button" title="Dropdown button" onSelect={(event,e)=>this.getsign(event,e.target.value)}>
<Dropdown.Item as="option" value='option1'>Option 1</Dropdown.Item>
<Dropdown.Item as="option" value='option2'>Option 2</Dropdown.Item>
</DropdownButton>
function getsign(events,value){
console.log('value :', value);
console.log('events :', events);
}
