Can you change that to this:
useEffect(() => {
// Update the document title using the browser API
const canvas = document.querySelector('canvas')!;
//create instance of the class as follows
const pbr = new PBR(canvas);
return () => {
pbr.engine.dispose();
}
},[]);
You should keep StrictMode - it’s designed to help you detect issues with your code.