public render() {
const menuButton = (
<Button
size="medium"
onClick={() => {
this.setState({ isOpen: !this.state.isOpen });
}}
style={{
color: "#f2070b",
border: "2px solid #f2070b",
backgroundColor: "transparent",
paddingLeft: "10px",
paddingRight: "10px"
}}
>
<strong>MENÚ</strong>
{this.state.isOpen ? (
<Icon name="angle up" style={{ marginLeft: "10px" }} />
) : (
<Icon name="angle down" style={{ marginLeft: "10px" }} />
)}
</Button>
);
现在,当您单击菜单时,它会显示出来,但是我必须再次单击它才能将其关闭,并且我希望在单击它时将其关闭。