DEV Community

Alec McEachran
Alec McEachran

Posted on

Synchronous Rendering

I have a WebGL context that updates on a frame-loop, within a broader React application.

I want to create a second React application to overlay an SVG element above the WebGL context, but critically I need this SVG element to update synchronously in the same frame that the WebGL context renders.

I understand that in most cases asynchronous rendering is a feature not a bug, but in my use-case, I need frame-by-frame integration between the WebGL update cycle and the SVG DOM updates.

It doesn't look like this is possible. flushSync forces updates, but doesn't force rendering. Is there a renderNow or similar function hiding in the React API?

Thanks in advance, Alec

Top comments (0)