Skip to content

v8.8.0

Compare
Choose a tag to compare
@CodyJasonBennett CodyJasonBennett released this 21 Sep 15:21
· 485 commits to master since this release

What's Changed

This release implements a context bridge within Canvas, enabling R3F children to consume context between renderers (e.g. react-dom or react-native), and removing the need for manually bridging context.

import * as React from 'react'
import * as ReactDOM from 'react-dom/client'
import { Canvas } from '@react-three/fiber'

const DOMContext = React.createContext()

function Component() {
  // "Hello from react-dom"
  console.log(React.useContext(DOMContext))
}

ReactDOM.createRoot(document.getElementById('root')).render(
  <DOMContext.Provider value="Hello from react-dom">
    <Canvas>
      <Component />
    </Canvas>
  </DOMContext.Provider>,
)

Full Changelog: v8.7.4...v8.8.0