Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://fb.me/react-15.1.0.js"></script>
<script src="https://fb.me/react-dom-15.1.0.js"></script>
<script src="//jashkenas.github.io/underscore/underscore-min.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <div class="main"></div>
</body>
</html>
 
.tool {
  &__body {
    width: 300px;
    height: 250px;
    background: #588
  }
}
 
/* jshint esnext: true */
class Tool extends React.Component {
  constructor(props) {
    super(props);
    this._onMouseMove = _.throttle(this._onMouseMove.bind(this), 2000);
  }
  render() {    
    return (
      <div ref="tool" className="tool">
        <div ref="toolBody"
             className="tool__body"
             onMouseMove={this._onMouseMove}>
        </div>
      </div>
    )
  }
  
  _onMouseMove(e) {
    e.persist()
    console.log(e.screenX)
  }
}
ReactDOM.render(<Tool/>, document.querySelector('.main'))
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers