Passive Event Listeners

How can I mark onWheel as { passive: true }
import "./NewsElements.scss";
import { NewsElement } from "./NewsElement";

export const NewsElements = () => {
let container: HTMLDivElement;

const handleWheel = (event: WheelEvent) => {
event.preventDefault();
container.scrollLeft += event.deltaY;
}

return <div ref={container!} class="chaos-news-elements" onWheel={handleWheel}>
<div class="chaos-news-elements--scroll-wrapper">
<NewsElement title="Lorem ipsum" description="Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet" />
<NewsElement title="Lorem ipsum" description="Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet" />
<NewsElement title="Lorem ipsum" description="Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet" />
</div>
</div>
}
import "./NewsElements.scss";
import { NewsElement } from "./NewsElement";

export const NewsElements = () => {
let container: HTMLDivElement;

const handleWheel = (event: WheelEvent) => {
event.preventDefault();
container.scrollLeft += event.deltaY;
}

return <div ref={container!} class="chaos-news-elements" onWheel={handleWheel}>
<div class="chaos-news-elements--scroll-wrapper">
<NewsElement title="Lorem ipsum" description="Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet" />
<NewsElement title="Lorem ipsum" description="Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet" />
<NewsElement title="Lorem ipsum" description="Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet" />
</div>
</div>
}
1 Reply
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server