Repository navigation
v0.9.0
What's Changed
- feat(hooks): useInstanceHandle by @CodyJasonBennett in #67
- refactor(types): dynamically map OGLElements by @CodyJasonBennett in #68
This release significantly improves type safety and maintainability and offers escape hatches for advanced use cases, originating from R3F in pmndrs/react-three-fiber#2465.
Dynamically mapped OGLElements
Additionally, OGL types for JSX.IntrinsicElements are no longer hard-coded and dynamically mapped to OGLElements. This lets us properly follow semver once @types/ogl is upstreamed.
Node => OGLElement
The Node interface has been simplified and renamed to OGLElement to prevent clashing with DOM types:
declare module 'react-ogl' {
interface OGLElements {
customElement: OGLElement<typeof CustomElement>
}
}
extend({ CustomElement })Access internals via useInstanceHandle
Exposes an object's react-internal Instance state from a ref.
Note: this is an escape hatch to react-internal fields. Expect this to change significantly between versions.
const ref = React.useRef<OGL.Transform>()
const instance = useInstanceHandle(ref)
React.useLayoutEffect(() => {
instance.parent.object.foo()
}, [])
<transform ref={ref} />Full Changelog: v0.8.1...v0.9.0