React-babylonjs v2.0

I have updated the react-babylonjs project. It was a major update, so bumped the major version to 2.

There are new features like declared physics and dynamic terrain, but the major breaking change is that it now references @babylonjs/* ES6 NPMs. It works with hooks, composing custom components and functional components like before, but another big change is support for intrinsic elements and editor support, so you can declare your BabylonJS scene using a more HTML-like syntax - they are written in JSX like normal DOM elements (ie: box, sphere & shadowGenerator, etc). Here is the dropdown property list for arcRotateCamera:

Here is a scene with a ground and sphere. Meshes, camera, lighting, GUI, shadows and physics are declared in the markup. The only “code” is the button click handler:

You can see working examples:
TypeScript: React App
Storybook: Storybook

There are a bunch more examples in storybook. Next steps for the project are an Electron sample and then attempting react native support with likely expo (like this question: Using BabylonJS with React Native)

Look forward to any feedback. Thanks.


This is really cool!

That deserves a documentation update !