React's mouseEvent doesn't have offsetX/offsetY
I try get position of click relative to element, but event doesn't have offsetX. onClick(e) { console.log(e.offsetX) // returns undefined console.log(e.target.offsetX) // returns undefined } render() { return <img src='http://placehold.it/1000x500' onClick={this.onClick} /> } How I can get position of click in element?
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.