'getting an error while setting up a onclick toggle function for creating Navbar

const Navbar = () => {
  const [toggle, setToggle] = useState(false)
return (--------------Navigation details----------------)

<div className={styles.app__navbar_menu}>
        <HiMenuAlt4 onClick={() => setToggle(true)} />

        {toggle && (
          <motion.div
            whileInView={{ x: [300, 0] }}
            transition={{ duration: 0.85, ease: 'easeOut' }}
          >
            <HiX onClick={() => setToggle(false)} />
          </motion.div>
        )}
      </div>

ERROR :

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source