1. Core Hooks
  2. useThrelteRoot

Core Hooks

useThrelteRoot

This hook lets you consume the root context. Although it can be useful, this is mostly used internally.
The properties linear, flat and dpr are reactive and can also be set.

Import

Source

GitHub View Source Code
INFO

This hook needs context. Use only in a child component to <Canvas>.


Types

const {
  setCamera, // (camera: Camera) => void
  linear, // Writable<boolean>
  flat, // Writable<boolean>
  dpr, // Writable<number>
  addPass, // (pass: Pass) => void
  removePass, // (pass: Pass) => void
  addRaycastableObject, // (obj: Object3D) => void
  removeRaycastableObject, // (obj: Object3D) => void
  addInteractiveObject, // (obj: Object3D) => void
  removeInteractiveObject, // (obj: Object3D) => void
  interactiveObjects, // Set<Object3D>
  raycastableObjects, // Set<Object3D>
  raycaster, // Raycaster
  lastIntersection // Intersection<Object3D<Event>> | null
} = useThrelteRoot()