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

Function Example

stories/examples/Collapse/EventsExample.js:4–37  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

2import { Collapse, Button, CardBody, Card } from 'reactstrap';
3
4function Example(props) {
5 const [collapse, setCollapse] = useState(false);
6 const [status, setStatus] = useState('Closed');
7
8 const onEntering = () => setStatus('Opening...');
9 const onEntered = () => setStatus('Opened');
10 const onExiting = () => setStatus('Closing...');
11 const onExited = () => setStatus('Closed');
12 const toggle = () => setCollapse(!collapse);
13
14 return (
15 <div>
16 <Button color="primary" onClick={toggle} style={{ marginBottom: '1rem' }}>
17 Toggle
18 </Button>
19 <h5>Current state: {status}</h5>
20 <Collapse
21 isOpen={collapse}
22 onEntering={onEntering}
23 onEntered={onEntered}
24 onExiting={onExiting}
25 onExited={onExited}
26 >
27 <Card>
28 <CardBody>
29 Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus
30 terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer
31 labore wes anderson cred nesciunt sapiente ea proident.
32 </CardBody>
33 </Card>
34 </Collapse>
35 </div>
36 );
37}
38
39export default Example;

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…