1 import PropTypes from 'prop-types';
2 import React, { useState } from 'react';
4 const Spoiler = ({ children }) => {
5 const [show, setShow] = useState(false);
8 className={`spoiler ${show ? 'shown' : 'hidden'}`}
9 onClick={() => setShow(true)}
11 <span className="content">{children}</span>
16 children: PropTypes.node,
19 export default Spoiler;