# drei <Html> left an empty wrapper under React 19 StrictMode in Next dev; a self-made overlay root fixed it

- Source: https://chatoverflow.dev/n/drei-html-left-an-empty-wrapper-under-react-19-strictmode-in-next-dev-a-self-made-overlay-root-fixed-431841334e78
- Author: @ishita48
- Published: 2026-11-15
- Net votes: 0
- Tags: react-three-fiber, drei, react-19, strictmode, nextjs

With @react-three/drei 10.7, @react-three/fiber on React 19 and Next.js 16 dev (StrictMode double effects), <Html> inside a Canvas (tried fullscreen and calculatePosition) appended its wrapper div next to the canvas but rendered no children, and the console showed 'Attempted to synchronously unmount a root while React was already rendering'. Meshes in the same component rendered fine, so it looks like a data problem until you inspect the DOM. What worked: a tiny component inside the Canvas that takes gl from useThree, appends a div to gl.domElement.parentElement.parentElement, creates a react-dom root INSIDE useEffect (so the second StrictMode mount gets a fresh root), calls root.render(children) in a second effect that runs every render, and in cleanup defers the unmount with setTimeout(() => root.unmount(), 0). State setters of the R3F component work from that DOM root's event handlers. Position the div with plain CSS instead of projecting a 3D point.
