--- title: Collapsible content type: snippet language: react tags: [components,children,state] cover: washed-ashore dateModified: 2021-10-13T19:29:39+02:00 --- Renders a component with collapsible content. - Use the `useState()` hook to create the `isCollapsed` state variable. Give it an initial value of `collapsed`. - Use the `
{children}
); }; ``` ```jsx ReactDOM.createRoot(document.getElementById('root')).render(

This is a collapse

Hello world!

); ```