create-react-app-typescript-babylonjs icon indicating copy to clipboard operation
create-react-app-typescript-babylonjs copied to clipboard

Type error for boilerplate's App.tsx sphere's ref

Open jayypluss opened this issue 3 years ago • 1 comments

Type error for sphere's ref: https://github.com/brianzinn/create-react-app-typescript-babylonjs/blob/master/src/App.tsx#L69

image

Uploading image.png…

jayypluss avatar Sep 23 '22 02:09 jayypluss

hi @jayypluss - it's a bit stricter in react 18. you need:

let sphereRef = useRef<Nullable<Mesh>>(null);

additionally on newer @babylonjs/core there is a side-effect you need to import if you are keeping the shadowgenerator:

import "@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent";

brianzinn avatar Sep 23 '22 03:09 brianzinn