Edit page

Globe Instance

react-globe provides ways to interact with the underlying globe instance through the onGetGlobe prop or the Globe class.

onGetGlobe Prop

The following interactive example demonstrates capturing the globe instance using the onGetGlobe prop. Once the globe instance is captured, you can hook it up to your application lifecycle. Useful methods include lock and unlock, and you have access to many other class methods.

The example also demonstrates that configuring the globe instance works interchangeably with component props. Use the Playground to observe how either instance methods or props updates can update the globe.

Edit Globe Instance


Edit Globe Props

Globe Class

You can also directly work with the Globe class by using the provided named export:

The Globe class allows you to create globe visualizations with vanilla Javascript without the need for React. In the following example, we demonstrate how we can create the globe with basic Javascript when given a mounting ref.

Note that while the Globe instance gives you full control on using the class in any code, we recommend that you still use the component to manage globe functionalities. There is a lot of work required to hook everything up together, and that's the whole point of what react-globe is trying to accomplish for you!