in the 6v version u cannot use useHistory anymore and i try to use useNavigate but cant do the same thing.
i have container with 4 components that are on the top of each other and i want that when i click on a button it wont just show me 1 component but will go down to the third component.
i tried to find a solution and couldn't please help :*)
#useHistory with useNavigate
1 messages · Page 1 of 1 (latest)
Are you trying to scroll to the third component?
yes
If so, you could add an id to your component, and use an anchor tag which refers to that id. Clicking on the anchor would made you jump to that component
<MyComp id="target-me" /> then the anchor which targets it would be the following: <a href='#target-me'>Jump to MyComp</>
They have a bigger example on the following site: https://www.w3docs.com/snippets/html/how-to-create-an-anchor-link-to-jump-to-a-specific-part-of-a-page.html
or take a look at the MDN doc:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#linking_to_an_element_on_the_same_page
i will check it thank you 🙂
good luck 🙂
it works but when im on another container it wont go to this container and anchor it