I am trying to create a helper function that I can use throughout my React application, but the behavior 'smooth' does not seem to be working.
const scrollRef = useRef()
const handleScroll = (ref) => {
return ref.current.scrollTo({ left: ref.current.scrollLeft -= 500, behavior: 'smooth' })
}
handleScroll(scrollRef)
it is scrolling to the position, but not smoothly. If I do not use this helper function it works fine. Do you have any ideas how to make this work?