scroll animation
Unanswered
Sun bear posted this in #help-forum
Sun bearOP
is there better way to do scroll
4 Replies
Sun bearOP
const handleScroll = () => {
questionRef.current?.nextElementSibling?.scrollIntoView({
behavior: "smooth",
});
};
const handleClick = (answer: string) => {
if (answer === question.answer) {
setScore((prev: number) => prev + 1);
if (scrollOn) {
requestAnimationFrame(() => {
questionRef.current?.nextElementSibling?.scrollIntoView({
behavior: "smooth",
});
});
}
}
};
when i choose some answer sirtly some blocks are rendered and after that scrolled to next sibling
but at some moment its annyoing when you see 2 thing happen at the same time