onChange
Description
Fires when a new option is selected in a rich selectUsage
onChange?: (ev: { value: string | number }) => void;
Parameters
The callback of the event takes an object with the following parameter:
- value - (required) an id of the newly selected option
Example
function handleSelect({ value }: { value: string | number }) {
console.log(value);
// an id of the newly selected option
}
<RichSelect onChange={handleSelect} />
Details
The handler function receives an object with an id of the newly selected option.
Related article: Catching the change of selected option