MCPcopy Create free account
hub / github.com/reactstrap/reactstrap / Example

Function Example

stories/examples/ButtonGroup/StatefulExample.js:4–24  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

2import { Button, ButtonGroup } from 'reactstrap';
3
4function Example(props) {
5 const [cSelected, setCSelected] = useState([]);
6 const [rSelected, setRSelected] = useState(null);
7
8 const onCheckboxBtnClick = (selected) => {
9 const index = cSelected.indexOf(selected);
10 if (index < 0) {
11 cSelected.push(selected);
12 } else {
13 cSelected.splice(index, 1);
14 }
15 setCSelected([...cSelected]);
16 };
17 return (
18 <div>
19 <h5>Radio Buttons</h5>
20 <ButtonGroup>
21 <Button
22 color="primary"
23 outline
24 onClick={() => setRSelected(1)}
25 active={rSelected === 1}
26 >
27 Radio 1

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…