re: React Beginner Question Thread ⚛ VIEW POST


Hi Dan!
What's the best way, in your opinion, do onScroll animation in react. It looks to me that the most performant way is to get ref to a DOM node and change styles on it directly which is not the 'React way' actually (implementing of course requestAnimationFrame and stuff). Is there a good way to implement it (talking about onscroll parallax effects) through a component state and rerender (React way)?



IMO that’s exactly what refs are useful for. Pretty much what I would do, yes.

code of conduct - report abuse