A React Component to handle dynamic collapsible content
npm install --save react-collapsible-content
yarn add react-collapsible-content
import React, { useState } from 'react';
import CollapsibleContent from 'react-collapsible-content';
function Toggle() {
const [expanded, setExpanded] = useState(false);
return (
<div>
<button onClick={() => setExpanded((prev) => !prev)}>TOGGLE</button>
<CollapsibleContent expanded={expanded}>
<p>
Lorem Ipsum is simply dummy text of the printing and
typesetting industry. Lorem Ipsum has been the industry's
standard dummy text ever since the 1500s when an unknown
printer took a galley of type and scrambled it to make a
type specimen book.
</p>
</CollapsibleContent>
</div>
);
}
Read documentation.
MIT © llorentegerman