Home > OS >  How to scroll to a component from another component in React?
How to scroll to a component from another component in React?

Time:02-27

I have a form that, on submission displays the results of the form, but more importantly, scrolls to a component that shows the results. I am stuck trying to pass in refs and forward refs. All of the demos I've seen have been of components in the same file. My setup is as follows:

The App.js holds two components– Form.js which submits the form and Results.js which displays the results of the form submission. The Results.js component is further down the page so I want to scroll to that component once the user clicks enter on the form.

Here is a Edit Scroll Component (forked)

  • Related