npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-cesium-fiber-r17

v0.3.0

Published

React-fiber renderer for cesium

Downloads

2

Readme

react-cesium-fiber

npm version

react-cesium-fiber is a React renderer for CesiumJs on the web.

What is it?

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.

Why do you need it?

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.

Getting started

1. Create your react app and add basic cesium configuration.

You can follow craco-cesium really nice tutorial. But note that you don't need to add resium.

2. Add react-cesium-fiber with your favorite provider.

npm install react-cesium-fiber

or

yarn add react-cesium-fiber

3. Add a Viewer in your app

import React from "react";
import { Viewer } from "react-cesium-fiber";

export const App = () => <Viewer />;

4. Add more components in your 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.

Core concepts

  • 📖 You need some basic knowledge of CesiumJs. react-cesium-fiber has a few specificities, such as the args and attach props, but once you grab those basic concepts, it quickly falls back to vanilla CesiumJs.
  • 🧩 Every CesiumJs object can be instanced as a children of the Viewer. They don't need to have a Capitalized name as react-cesium-fiber recognize them as native components.
  • 🚪 react-cesium-fiber is built in a way that always let you fallback to vanilla CesiumJs if you need. Using React ref, you can access the CesiumJs objects and manually update them.
  • 🔍 TypeScript types and props autocomplete should help you to get started.

More details about the ➡️ API here ⬅️

A few notes

  • Greatly inspired by the amazing react-three-fiber package and this mind-blowing video of Sophie Alpert.
  • Based on the work of the Cesium team and the CesiumJS library.
  • react-cesium-fiber is a very young project. If you are looking for something more production-ready, you can have a look at resium (even if I think that react-cesium-fiber conception is way easier to maintain.)