1.0.4 • Published 9 months ago

@mesmotronic/react-observable-div v1.0.4

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
9 months ago

ObservableDiv for React

This library provides a React component that creates a <div> element for embedding non-React things into, that dispatches events when it's mounted, unmounted or resized.

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

This component provides the ideal host for things like a Three.js canvas, for example.

Strict mode

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

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago