0

I have a Parent component with two Children component inside. In one of the children I have a form, in the other one I have a List(I map over it to get each individual item).

When I submit that form It will create an "item" inside that List.

What I would like to achive is: when I submit the form to scroll to that new item that is created inside the List. I am using a functional approach in case that someone wants to put an exemple, if not I would be more than happy with the theory behind it to make it like a reactive way.

I have tried this but it isn't the exact thing of what I want. I did also try with useRef, but it keeps telling me that it is undefined

function topFunction() {
    document.documentElement.scrollBy(0, -1000);
  }
ESCoder
  • 15,431
  • 2
  • 19
  • 42

0 Answers0