useRef() Hook on a custom component
问题 I'm trying do create a Navigation Bar that when the user click on one of the links, the page scrolls to some section. In the code above, each element is a section of my page: <Navbar scrollFunc={scrollToRef} /> <Mainlogo ref={mainLogoRef} /> <Sales ref={salesRef} /> <Introduction ref={introductionRef} /> <Blog ref={blogRef} /> <Footer /> The 'refs' was declares as folowing, using the useRef hook: const mainLogoRef = useRef(null) const salesRef = useRef(null) const introductionRef = useRef