An open API service indexing awesome lists of open source software.

https://github.com/mesmotronic/react-observable-div

React component that provides a div element for embedding non-React things into, that tells you when it's mounted, unmounted or resized
https://github.com/mesmotronic/react-observable-div

div mount observable react resize threejs unmount

Last synced: 4 months ago
JSON representation

React component that provides a div element for embedding non-React things into, that tells you when it's mounted, unmounted or resized

Awesome Lists containing this project

README

          

# ObservableDiv for React

This library provides a React component that creates a `

` element for
embedding non-React things into, that dispatches events when it's mounted,
unmounted or resized.

```ts
console.log("Mounted", domElement)}
onUnmount={() => console.log("Unmounted")}
onResize={({ width, height }) =>
console.log(`Resized to ${width} x ${height}`)
}
>
{/* You can optionally put content here */}

```

This component provides the ideal host for things like a [Three.js](https://threejs.org)
canvas, for example.

## Strict mode

Please keep in mind that React's `` may cause this component to
dispatch the mount event twice in development. This is a know issue with
`` that affects all components and should be managed appropriately.