I rendered some elements with a functional component and I'm trying to select some of the elements to log them out to the console, but it logs out null
. is there a special method used to select react elements?
This is my code:
let menuIcon = <i className=" bi bi-list" id="menu-icon"></i>
let cvIcon = <i className="bi bi-caret-down-fill"></i>
export default function Navbar() {
return (
<nav>
<div id="menu">
{menuIcon}
<div id="menu-list-container">
<a href="#about">ABOUT</a>
<a href="#stack">STACK</a>
<a href="#contact">CONTACT</a>
<a href="#project">PROJECTS</a>
</div>
</div>
<div id="logo">
<span id="v">V</span>
<span id="s">S</span>
<span id="c">C</span>
</div>
<div id="cv-container">
<button>
<input type="button" name="cv-btn" value="RESUME" id="cv-btn"/>
{cvIcon}
</button>
<div>
<a href="">Download CV</a>
<a href="">View CV</a>
</div>
</div>
</nav>
);
}
const root = document.getElementById("root");
createRoot(root).render(<Navbar></Navbar>);
const menuList = document.getElementById("menu-list-container")
console.log(menuList)