Answer the question
In order to leave comments, you need to log in
How to do a class switch?
I have two components.
The first component contains the code for displaying the button and the hook. The second component contains a menu that should appear when you click on the button from the first component, but I did something wrong. Tell me how to pass parameters from one component to another correctly?
const [menuOpened, setMenuOpened] = useState("false");
const handleToggle = () => {
setMenuOpened(!menuOpened);
};
return (
<div
className={[styles.hamburger, styles.topLineHamburger].join(
" "
)}
onClick={handleToggle}
>
<span className={styles.hamburgerItem}></span>
</div>{" "} )}
export default function Navbar(props) {
console.log(props);
return (
<nav className={styles.navbar}>
<div className="container">
<div className={props ? "d-none" : " "}>
)}
Answer the question
In order to leave comments, you need to log in
You have everything mixed up and styles from css and styles from modules, in general, everything is mixed. Here I threw it as I understood what you need https://codesandbox.io/s/heuristic-currying-jm0ur?...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question