react-select icon indicating copy to clipboard operation
react-select copied to clipboard

How to pass multiple parameters in onChange

Open jsingh27 opened this issue 9 years ago • 3 comments

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 :)

jsingh27 avatar Jan 23 '17 15:01 jsingh27

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")} />

ErezSha avatar Feb 06 '17 14:02 ErezSha

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.

bladey avatar May 27 '20 06:05 bladey

dfgsfgdfg

programmer-nur avatar Dec 16 '22 13:12 programmer-nur