![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@react-three/drei
Advanced tools
@react-three/drei is a collection of useful helpers and abstractions for react-three-fiber, which is a React renderer for three.js. It provides a wide range of components and utilities to simplify the creation of 3D scenes in React applications.
Camera Controls
The OrbitControls component allows you to easily add camera controls to your 3D scene, enabling users to rotate, zoom, and pan the camera.
import { OrbitControls } from '@react-three/drei';
function Scene() {
return (
<Canvas>
<OrbitControls />
{/* other components */}
</Canvas>
);
}
Environment
The Environment component allows you to quickly set up a realistic lighting environment using HDRI images. You can choose from various presets like 'sunset', 'dawn', 'night', etc.
import { Environment } from '@react-three/drei';
function Scene() {
return (
<Canvas>
<Environment preset="sunset" />
{/* other components */}
</Canvas>
);
}
Loading Models
The useGLTF hook allows you to easily load and display GLTF models in your scene. It returns the loaded scene, which you can then use as a primitive object.
import { useGLTF } from '@react-three/drei';
function Model() {
const { scene } = useGLTF('/path/to/model.glb');
return <primitive object={scene} />;
}
function Scene() {
return (
<Canvas>
<Model />
{/* other components */}
</Canvas>
);
}
Text
The Text component allows you to easily add 3D text to your scene. You can customize the font, size, color, alignment, and other properties.
import { Text } from '@react-three/drei';
function Scene() {
return (
<Canvas>
<Text
color="black"
fontSize={1}
maxWidth={200}
lineHeight={1}
letterSpacing={0.02}
textAlign={'left'}
font="/path/to/font.woff"
anchorX="center"
anchorY="middle"
>
Hello World
</Text>
{/* other components */}
</Canvas>
);
}
Three.js is the core library for creating 3D graphics in the browser. While it provides a comprehensive set of features for 3D rendering, it requires more boilerplate code compared to @react-three/drei, which offers higher-level abstractions and components.
React-three-fiber is a React renderer for three.js. It allows you to build and manage 3D scenes using React components. @react-three/drei is built on top of react-three-fiber and provides additional helpers and components to simplify common tasks.
A-Frame is a web framework for building virtual reality experiences. It is built on top of three.js and provides a declarative, HTML-like syntax for creating 3D scenes. While it is not React-based, it offers similar functionalities for building 3D environments.
A growing collection of useful helpers and fully functional, ready-made abstractions for @react-three/fiber.
If you make a component that is generic enough to be useful to others, think about CONTRIBUTING!
npm install @react-three/drei
[!IMPORTANT] this package is using the stand-alone
three-stdlib
instead ofthree/examples/jsm
.
import { PerspectiveCamera, PositionalAudio, ... } from '@react-three/drei'
import { PerspectiveCamera, PositionalAudio, ... } from '@react-three/drei/native'
The native
route of the library does not export Html
or Loader
. The default export of the library is web
which does export Html
and Loader
.
[!WARNING] Below is an archive of the anchors links with their new respective locations to the documentation website. Do not update the links below, they are for reference only.
$ corepack enable
$ yarn install
Pre-requisites:
$ npx playwright install
To run visual tests locally:
$ yarn build
$ yarn test
To update a snapshot:
$ PLAYWRIGHT_UPDATE_SNAPSHOTS=1 yarn test
[!IMPORTANT] Snapshots are system-dependent, so to run playwright in the same environment as the CI:
$ docker run --init --rm \
-v $(pwd):/app -w /app \
ghcr.io/pmndrs/playwright:drei \
sh -c "corepack enable && yarn install && yarn build && yarn test"
To update a snapshot:
$ docker run --init --rm \
-v $(pwd):/app -w /app \
-e PLAYWRIGHT_UPDATE_SNAPSHOTS=1 \
ghcr.io/pmndrs/playwright:drei \
sh -c "corepack enable && yarn install && yarn build && yarn test"
FAQs
useful add-ons for react-three-fiber
The npm package @react-three/drei receives a total of 0 weekly downloads. As such, @react-three/drei popularity was classified as not popular.
We found that @react-three/drei demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.