I'm trying to write scroll function in React. I'm catching the DOM element by getElementsByName.
handleScroll=(i, e )=>{
    const {errors} = this.props
    const elementsName = Object.keys(errors)
    const elementScroll = document.getElementsByName(elementsName[i])
    elementScroll.scrollIntoView({ blok: "start", behavior: "smooth" });
}
And when I executed this function i recived "scrollIntoView is not a function" error. The element is catched correctly but the scrollIntoView function is making problems.
UPDATE Problem solved i used
document.querySelector(`[name="${elementsName[i]}"]`)
 
    