mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Check for onChange() availability
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
d8f6ae4fa9
commit
58d9a09902
@ -32,7 +32,7 @@ export function Switch({ children, disabled, onChange, ...props }: Props) {
|
||||
return (
|
||||
<label className={cssNames(styles.Switch, { [styles.disabled]: disabled })} data-testid="switch">
|
||||
{children}
|
||||
<input type="checkbox" role="switch" disabled={disabled} onChange={(event) => onChange(props.checked, event)} {...props}/>
|
||||
<input type="checkbox" role="switch" disabled={disabled} onChange={(event) => onChange?.(props.checked, event)} {...props}/>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user