React-bootstrap: Code examples of react-bootstrap Checkbox component onClick handler.

Created on 7 Feb 2017  路  3Comments  路  Source: react-bootstrap/react-bootstrap

I need to attach a onClick handler to a react-bootstrap CheckBox component that will pass the status (checked/unchecked) to the handler, so I can use this to modify the route.

I am having trouble finding a clear code example of setting up a function as a handler on the onClick for a CheckBox component and how to pass the CheckBox status to that function.

If you could direct me to a good example it would be helpful. Or if I'm just doing it "the hard way" direct me to an alternate approach that can achieve this.

Most helpful comment

<Checkbox onClick={e => handler(e.target.checked)} />

All 3 comments

<Checkbox onClick={e => handler(e.target.checked)} />

It's the same as if it were a normal React <checkbox>, anyway.

thanks

Was this page helpful?
0 / 5 - 0 ratings