r/reactjs • • Mar 18 '22

Show /r/reactjs Game in React Three Fiber 💪

538 Upvotes

22 comments sorted by

View all comments

5

u/azangru Mar 18 '22

How's the battery usage?

11

u/[deleted] Mar 18 '22

/u/ostjh

<Canvas frameloop="demand">

will only render when props change or when anything calls invalidate(). react-spring does that automatically for instance but you can use anything and basically just invalidate in onChange and it'll be fine. this will completely stop doing anything when nothing's moving, battery will be fine. great game btw! :-)

6

u/ostjh Mar 18 '22

Hei @drcmda thank you very much, I will implement it 💪