made with esnextbin
Last active
April 23, 2017 02:01
-
-
Save Hypnosphi/f60599465a3b507726babfbdecf2bd46 to your computer and use it in GitHub Desktop.
esnextbin sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
</head> | |
<body> | |
<div id="app"></div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// write ES2015 code and import modules from npm | |
// and then press "Execute" to run your program | |
import React from 'react' | |
import {render} from 'react-dom' | |
let prevE = null | |
const logger = id => e => { | |
console.log(`${id}: ${e.nativeEvent.movementX}`) | |
prevE = e | |
} | |
const Example = () => ( | |
<div onMouseMove={logger('parent')}> | |
<div | |
onMouseMove={logger('child')} | |
style={{ | |
height: 500, | |
width: '100%', | |
backgroundColor: '#ffe' | |
}} | |
/> | |
</div> | |
) | |
render(<Example/>, document.querySelector('#app')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"react": "15.4.2", | |
"react-dom": "15.4.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var _react = require('react'); | |
var _react2 = _interopRequireDefault(_react); | |
var _reactDom = require('react-dom'); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
// write ES2015 code and import modules from npm | |
// and then press "Execute" to run your program | |
var prevE = null; | |
var logger = function logger(id) { | |
return function (e) { | |
console.log(id + ': ' + e.nativeEvent.movementX); | |
prevE = e; | |
}; | |
}; | |
var Example = function Example() { | |
return _react2.default.createElement( | |
'div', | |
{ onMouseMove: logger('parent') }, | |
_react2.default.createElement('div', { | |
onMouseMove: logger('child'), | |
style: { | |
height: 500, | |
width: '100%', | |
backgroundColor: '#ffe' | |
} | |
}) | |
); | |
}; | |
(0, _reactDom.render)(_react2.default.createElement(Example, null), document.querySelector('#app')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment