ReactUnity APIs

ReactUnity works with a collection of packages on the Javascript side. These are @reactunity/renderer and @reactunity/scripts.

Renderer

@reactunity/renderer is an npm package that handles the rendering login of the React virtual DOM. Without going into details, it is much alike react-dom in what it does.

import { render } from '@reactunity/renderer';

render(<view>Hello world!</view>)

In addition to its rendering functionality, it also includes Typescript types and utilities to improve development experience.

Scripts

@reactunity/scripts is the collection of npm scripts and Webpack configuration that can be used to easily build and run ReactUnity projects. It is an npm package and it should be included in devDependencies.

Starting

Terminal
react-unity-scripts start

Starts the Webpack Dev Server with Fast Refresh configuration.

Building

Terminal
react-unity-scripts build

Builds the project into statical files to be production-ready.