pmndrs / react-three-fiber

🇨🇭 A React renderer for Three.js

Home Page:https://docs.pmnd.rs/react-three-fiber

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Canvas eventHandler: onWebGLContextLost, onWebGLContextRestored

timohausmann opened this issue · comments

Wouldn't it add value to add these events to the Canvas element?

<Canvas
  onWebGLContextLost={() => console.log('onWebGLContextLost')}
  onWebGLContextRestored={() => console.log('onWebGLContextRestored')}
></Canvas>

I'm trying to add these events to my app and I feel like it could be more straight forward.
Would be helpful to expose RootState in the events if possible.

We can't tie ourselves to a single backend -- e.g. WebGL or WebGPU. I would keep these in your app, and a good place to subscribe to the WebGL canvas is within the Canvas onCreated callback or another component within.

We can't tie ourselves to a single backend -- e.g. WebGL or WebGPU. I would keep these in your app, and a good place to subscribe to the WebGL canvas is within the Canvas onCreated callback or another component within.

Okay, thanks for the explanation.