pmndrs / react-three-fiber

🇨🇭 A React renderer for Three.js
https://docs.pmnd.rs/react-three-fiber
MIT License
27.62k stars 1.6k forks source link

Update Canvas.tsx types and how children is rendered #3264

Open joevingracien opened 6 months ago

joevingracien commented 6 months ago

This change is an attempt to make children "optional" and get rid of types workarounds.

For instance in cases like react-three-next:

export default function Scene({ ...props }) {
  return (
    <Canvas {...props}
      onCreated={(state) => (state.gl.toneMapping = THREE.AgXToneMapping)}
    >
      {/* @ts-ignore */}
      <r3f.Out />
      <Preload all />
    </Canvas>
  )
}

We wouldn't be obliged to put @ts-ignore anymore.

codesandbox-ci[bot] commented 6 months ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit e5e36415e2599f1e80fc386da17ebf42cab2eb6c:

Sandbox Source
example Configuration