made with esnextbin
Created
March 27, 2017 17:31
-
-
Save Willmo36/141383738e16a30b12521d0f4d73e03d to your computer and use it in GitHub Desktop.
esnextbin sketch
This file contains hidden or 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 --> | |
<link rel="stylesheet" href="https://kitbag.footballradar.com/index.min.css" /> | |
</head> | |
<body> | |
<div id="app" /> | |
</body> | |
</html> |
This file contains hidden or 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
import React from "react"; | |
import RD from "react-dom"; | |
var cbs = []; | |
setTimeout(() => cbs.map(cb => cb()), 500); | |
class Parent extends React.Component { | |
componentDidMount(){ | |
cbs.push(() => this.setState({hello: 1})); | |
} | |
render(){ | |
console.log("parent"); | |
return <Child />; | |
} | |
} | |
class Child extends React.Component { | |
componentDidMount(){ | |
cbs.push(() => this.setState({hello: 1})); | |
} | |
render(){ | |
console.log("child"); | |
return <p>hello</p> | |
} | |
} | |
RD.render(<Parent />, document.querySelector("#app")); |
This file contains hidden or 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", | |
"babel-runtime": "6.22.0" | |
} | |
} |
This file contains hidden or 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"); | |
var _reactDom2 = _interopRequireDefault(_reactDom); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var cbs = []; | |
setTimeout(function () { | |
return cbs.map(function (cb) { | |
return cb(); | |
}); | |
}, 500); | |
var Parent = function (_React$Component) { | |
(0, _inherits3.default)(Parent, _React$Component); | |
function Parent() { | |
(0, _classCallCheck3.default)(this, Parent); | |
return (0, _possibleConstructorReturn3.default)(this, (0, _getPrototypeOf2.default)(Parent).apply(this, arguments)); | |
} | |
(0, _createClass3.default)(Parent, [{ | |
key: "componentDidMount", | |
value: function componentDidMount() { | |
var _this2 = this; | |
cbs.push(function () { | |
return _this2.setState({ hello: 1 }); | |
}); | |
} | |
}, { | |
key: "render", | |
value: function render() { | |
console.log("parent"); | |
return _react2.default.createElement(Child, null); | |
} | |
}]); | |
return Parent; | |
}(_react2.default.Component); | |
var Child = function (_React$Component2) { | |
(0, _inherits3.default)(Child, _React$Component2); | |
function Child() { | |
(0, _classCallCheck3.default)(this, Child); | |
return (0, _possibleConstructorReturn3.default)(this, (0, _getPrototypeOf2.default)(Child).apply(this, arguments)); | |
} | |
(0, _createClass3.default)(Child, [{ | |
key: "componentDidMount", | |
value: function componentDidMount() { | |
var _this4 = this; | |
cbs.push(function () { | |
return _this4.setState({ hello: 1 }); | |
}); | |
} | |
}, { | |
key: "render", | |
value: function render() { | |
console.log("child"); | |
return _react2.default.createElement( | |
"p", | |
null, | |
"hello" | |
); | |
} | |
}]); | |
return Child; | |
}(_react2.default.Component); | |
_reactDom2.default.render(_react2.default.createElement(Parent, null), document.querySelector("#app")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment