import React, { useEffect, useState } from "react";
import './Menu.css'
export default function Menu() {
const [classes, setClasses] = useState('container')
return (
<div>
<p>Click on the Menu Icon to transform it to "X":</p>
<div className={classes} onClick={() => setClasses("container change")}>
<div className="bar1"></div>
<div className="bar2"></div>
<div className="bar3"></div>
</div>
</div>
)
}
It works now because of one of the given solutions, but when I click on the icon again, it doesn't go back to the original state. How can I fix that?
I got this menu example from here: https://www.w3schools.com/howto/howto_css_menu_icon.asp