import React from 'react' import Toggle from './Toggle' import { toggle } from '../lib/util' class Collapse extends React.PureComponent { state = { open: false } toggle = () => this.setState(toggle('open')) render() { if (this.state.open) { return this.props.children } return ( ) } } export default Collapse