I have a simple div, with a function to obtain the coordinates of the mouse inside this div.
<div onMouseMove={this._onMouseMove}></div>
This function saves in the state, the coordinates of the div
constructor() {
super();
this.state = {
selectedVariables: [],
mouseCordinates: {x: 0, y: 0}
};
}
_onMouseMove = e => {
this.setState({x: e.screenX, y: e.screenY});
console.log(`x: ${e.screenX}, y: ${e.screenY}`);
}
And now I want to draw the variable helloWorld in this div in these concrete coordinates
helloWorld = 'Hello World';
<div onMouseMove={this._onMouseMove}>
// Into this div it must paint the variable according to the coordinates
</div>
This is possible? Any ideas?
Thanks for your help.