made with esnextbin
Created
June 16, 2017 23:43
-
-
Save mauriciopoppe/6452fc897b7c45202cbd2ecd9da69a95 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="root"></div> | |
<!-- put markup and other contents here --> | |
</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
window.d3 = require('d3'); | |
const functionPlot = require('function-plot') | |
import React from 'react'; | |
import { render } from 'react-dom'; | |
class App extends React.Component { | |
componentDidMount() { | |
functionPlot({ | |
target: '#demo', | |
data: [ | |
{ | |
fn: 'x^2', | |
derivative: { | |
fn: '2x', | |
updateOnMouseMove: true, | |
}, | |
}, | |
], | |
}); | |
} | |
render() { | |
return <div id="demo" />; | |
} | |
} | |
render(<App />, document.getElementById('root')); |
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", | |
"d3": "3.3.8", | |
"function-plot": "1.17.3", | |
"babel-runtime": "6.22.0" | |
} | |
} |
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 _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); | |
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); | |
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | |
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | |
var _createClass2 = require('babel-runtime/helpers/createClass'); | |
var _createClass3 = _interopRequireDefault(_createClass2); | |
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); | |
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | |
var _inherits2 = require('babel-runtime/helpers/inherits'); | |
var _inherits3 = _interopRequireDefault(_inherits2); | |
var _react = require('react'); | |
var _react2 = _interopRequireDefault(_react); | |
var _reactDom = require('react-dom'); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
window.d3 = require('d3'); | |
var functionPlot = require('function-plot'); | |
var App = function (_React$Component) { | |
(0, _inherits3.default)(App, _React$Component); | |
function App() { | |
(0, _classCallCheck3.default)(this, App); | |
return (0, _possibleConstructorReturn3.default)(this, (App.__proto__ || (0, _getPrototypeOf2.default)(App)).apply(this, arguments)); | |
} | |
(0, _createClass3.default)(App, [{ | |
key: 'componentDidMount', | |
value: function componentDidMount() { | |
functionPlot({ | |
target: '#demo', | |
data: [{ | |
fn: 'x^2', | |
derivative: { | |
fn: '2x', | |
updateOnMouseMove: true | |
} | |
}] | |
}); | |
} | |
}, { | |
key: 'render', | |
value: function render() { | |
return _react2.default.createElement('div', { id: 'demo' }); | |
} | |
}]); | |
return App; | |
}(_react2.default.Component); | |
(0, _reactDom.render)(_react2.default.createElement(App, null), document.getElementById('root')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment