2

I want my browser to jump to the div tag of my form that is displayed when state is set to true on button click, however best I can get is jump to focus which wont be good when user clicks button and the form first field is visible on the page already. I tried adding

this.myRef = React.createRef();

on my component constructor and

this.myRef.current.scrollIntoView();

on the showForm method and I have ref on the div I want to jump to:

<div ref={this.myRef}>

How can I make it jump to the myRef div (making it be at the top after clicking it)?

nemadmasd
  • 21
  • 1

0 Answers0