estou tendo dificuldade em compartilhar estados entre componentes utilizando o react hooks. Alguém pode me dar um help?
import React, { useState } from 'react'
import Nav from './Nav'
export default function Header(){
const [open, setOpen] = useState(false);
return(
<header className="header">
<div className="container">
<Nav/>
<div className="hamburger" id="hamburger-6" onClick={() => setOpen(!open)} className={open ? "is-active": ""}>
<span className="line"></span>
<span className="line"></span>
<span className="line"></span>
</div>
</div>
</header>
);
}
Eu preciso compartilhar a state open com o componente Nav
import React, { useState, useEffect } from 'react'
export default function Nav(){
const [open, setOpen] = useState(false);
return(
<nav className={open ? "header__nav active": "header__nav"}>
<Link to="/" className="header__nav--link" onClick={() => setOpen(!open)} >Início</Link>
<Link to="/sobre" className="header__nav--link" onClick={() => setOpen(!open)} >Sobre</Link>
<Link to="/habilidades" className="header__nav--link" onClick={() => setOpen(!open)} >Habilidades</Link>
<Link to="/projetos" className="header__nav--link">Projetos</Link>
<Link to="/contato" className="header__nav--link">Contato</Link>
</nav>
);
}