I am building a table horizontally scroll. But it has DOM selector. How I build it with out DOM Selector. Have any way to do it with state ?
const onWheel = e => {
e.preventDefault();
const container = document.getElementById("container");
const containerScrollPosition = document.getElementById("container").scrollLeft;
container.scrollTo({
top: 0,
left: containerScrollPosition + e.deltaY,
behaviour: "smooth"
});
};
my demo: https://codesandbox.io/s/silly-lamport-2do0l?file=/src/App.js .