How to pass multiple parameters in onChange method, by default it pass only the value.
I am working with redux form and creating a nested selected options.
Thanks :)
Hi, you can do something like:
function onChange(id) {
const _onChange = (val) => {
console.log(`id: ${id}, new value: ${val}`);
}
return _onChange; // you can also do return _onChange.bind(this) if you need the scope.
}
then pass the result of the onChange function into the onChange prop of select:
<Select onChange={onChange("hello world")} />
Hello -
In an effort to sustain the react-select project going forward, we're closing old issues / pull requests.
We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest version.
If you feel this issue / pull request is still relevant and you'd like us to review it, please leave a comment and we'll do our best to get back to you.
Most helpful comment
Hi, you can do something like:
then pass the result of the onChange function into the onChange prop of select:
<Select onChange={onChange("hello world")} />