Scroll to the end of h1 tag thats overflow is hidden in reactjs

So i have an h1 tag which has its overflow hidden and what i want to do is make it so it auto scrolls to the end of the text without showing the scroll bar. I’ve tried a lot of ways but I couldn’t find any suitable for me.
I tried using refs

myref.current.scrollIntoView()

It didn’t work then I tried

myref.current.scrollTo(1000)

but that didn’t do anything it just showed an error in the console.