onChange
Description
Fires when a new option is selected in a comboUsage
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 or "" if the value is cleared
Example
function handleSelect({ value }: { value: string | number }) {
console.log(value);
// an id of the selected option
}
<Combo onChange={handleSelect} />
Details
The handler function receives an object with an id of the newly selected option or "" if the value is cleared.
Related article: Catching the change of the selected option