react-cesium-fiber is a React renderer for CesiumJs on the web.
react-cesium-fiber is a custom React renderer which lets you create cesium components.
With react-cesium-fiber, you can easily create a 3D globe of the Earth and add custom imagery or terrain providers, add 3D geometries, labels or even point-clouds.
Every feature proposed by CesiumJs is available in react-cesium-fiber. See the details of what you can do with CesiumJs on their website.
By default, CesiumJs has an imperative API. react-cesium-fiber transforms this in a declarative API. You simply specify what you want and react-cesium-fiber deals with the creation, updates and deletion of your components.
With react-cesium-fiber, you can profit from all the features React and its ecosystem bring, such as encapsulating and reusing logic in components. Your CesiumJs app now reacts easily to state changes, abstracting all the tedious work of maintaining your state and CesiumJs up to-date.
You can follow craco-cesium really nice tutorial. But note that you don't need to add resium.
npm install react-cesium-fiber
or
yarn add react-cesium-fiber
import React from "react";
import { Viewer } from "react-cesium-fiber";
export const App = () => <Viewer />;
import React from "react";
import { Color } from "cesium";
import { Viewer } from "react-cesium-fiber";
export const App = () => (
<Viewer>
<entity>
<cartesian3
attach="position"
constructFrom="fromDegrees"
args={[-114.0, 30.0, 300000.0]}
/>
<boxGraphics attach="box" material={Color.RED}>
<cartesian3 attach="dimensions" args={[400000.0, 300000.0, 500000.0]} />
</boxGraphics>
</entity>
</Viewer>
);
Note that you don't need to import entity, cartesian3 or boxGraphics. That's the magic of the react-reconciler.
args and attach props, but once you grab those basic concepts, it quickly falls back to vanilla CesiumJs.ref, you can access the CesiumJs objects and manually update them.More details about the ➡️ API here ⬅️