Capture the value of "CSwitch" in CoreUi React

Viewed 27

I just want to know how to capture the value of a "CSwitch"

<CSwitch 
     name={element.Field}
     color={'primary'}
     variant='opposite'
     shape='pill'
     onChange={e => console.log(e.target.value)}
/>

The value that I get in the console.log is always "on"

1 Answers

The way to capture the value is

e.target.checked
Related