Skip to content

Instantly share code, notes, and snippets.

@aaroneaton
Created November 3, 2017 15:01
Show Gist options
  • Save aaroneaton/59133ecfe84d5e1f21462dd3e8292a0b to your computer and use it in GitHub Desktop.
Save aaroneaton/59133ecfe84d5e1f21462dd3e8292a0b to your computer and use it in GitHub Desktop.
class MyComponent extends React.Component {
...
render() {
return (
<div className="parent">
<div className="child" ref={el => this.targetEl = el}>Content Here</div>
</div>
)
}
...
)
const dropTarget = {
hover: (props, monitor, component) {
// Get the target bounding rectangle
const hoverBoundingRect = component.decoratedComponentInstance.contentEl.getBoundingClientRect();
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment