Skip to content

Instantly share code, notes, and snippets.

@damon-kreft
Last active April 19, 2017 16:34
Show Gist options
  • Save damon-kreft/bef8a1593428b513d01865ca2b4d951d to your computer and use it in GitHub Desktop.
Save damon-kreft/bef8a1593428b513d01865ca2b4d951d to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
let instance = null;
export const getTop = () => {
return instance.getTop();
}
export default class InjectPoint {
constructor() {
super();
instance = this;
}
render() {
return <div ref="inject">{this.props.children}</div>;
}
getTop() {
const domElement = ReactDOM.findDOMNode(this.refs.inject);
return domElement.sammink // cant remember how to get the position of a DOM element
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment