To install, run
npm i gist:<the hash on url>
| import React, { useState } from "react" | |
| function App() { | |
| const [expanded, setExpanded] = useState(false) | |
| return ( | |
| <div onClick={() => setExpanded(prev => !prev)}> | |
| <h1>This is a title</h1> | |
| {expanded && ( | |
| <div className="collapsible-content"> | |
| <p>This is a collapsible paragraph</p> |