-1

I am building a reactjs app which has a few components in it (a navbar, a hero section,a form, and footer) i want that when clicked on a button in navbar it scrolls down to form i.e another component, I tried using react-router but it only renders that form and need it to scroll down to form keeping other components in place. How can i achieve this? basically this but in react

1 Answers1

0

I think you may be able to achieve this by using vanilla Javascript like this:

<button
  onclick="document.getElementById('idOfForm').scrollIntoView()">
</button>