React Fiber is an amazing way to integrate three.js into your project in a much easier way, at least in my opinion.
React Fiber is essentially a React renderer for three.js. Meaning if you are very comfortable and familiar with using React it allows you to set up your app in a very similar way to a regular React app.
According to their docs everything that works with three.js works in React Fiber and there are no exceptions. Not only that it keeps updating with three.js to make sure all your code is up to date.
If you are interested I advise you to look over all the docs but for this blog I will help you understand setting up your first scene.
What is a scene?
A scene is essential in React Fiber. A scene is where all of the elements of your React Fiber are able to be displayed. Its the environment where everything lives.
How to setup a Scene
In React Fiber this can be done simply by the import { Canvas } as seen in the example below.

In three.js in order for it to run you need 3 things: a scene, a camera, and a renderer. With the Canvas import it does all of these for us in the background. It sets up a Scene and a Camera, the basic building blocks necessary for rendering and It renders our scene every frame, you do not need a traditional render-loop. Sidenote, this gives you a default camera, if you want different cameras read the documentation here on React Drei.
The next important element that must be added is lighting, this is what allows us to see around the scene and as well if you are wanting to turn 2D objects into 3D objects then you will need certain lighting for that. For now though, we are just going to focus on adding basic lighting for 2D shapes.
You can do that by adding an ambientLight and DirectionalLight like below.

Ambient light is just the environmental light that sheds on everything, whereas the directional light is light coming from a specific direction that can help highlight features of your objects.
Now you have a basic scene created you can now add some geometry and see them come to life and play around with the camera settings to be able to create 3D objects or shine light in a different direction. Follow the blog for the next installment where we go over geometry and adding basic shapes into your scene such as cubes, spheres, cones, etc…




































