made with esnextbin
Last active
March 16, 2017 17:24
-
-
Save conorhastings/1911224ff4bc0b93a205b10c60b4be83 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 --> | |
</head> | |
<body> | |
<div id="app"></div> | |
<!-- put markup and other contents here --> | |
</body> | |
<script src="//unpkg.com/preact"></script> | |
<script src="//unpkg.com/proptypes"></script> | |
<script src="//unpkg.com/preact-compat"></script> | |
<script> | |
var React = preactCompat, | |
ReactDOM = preactCompat; | |
</script> | |
</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 preact from "preact"; | |
import React from "preact-compat"; | |
import ReactDOM from "preact-compat"; | |
import PropTypes from "proptypes"; | |
import { css } from "glamor"; | |
const s = css({ fontSize: 12 }) | |
function Thing({ children, additionalStyle }) { | |
return <div {...css(s, additionalStyle)}><span>{children}</span></div>; | |
} | |
function X() { | |
return ( | |
<div> | |
<Thing key="1">View</Thing> | |
<Thing key="2">View</Thing> | |
</div> | |
); | |
} | |
ReactDOM.render(<X />, document.getElementById('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": { | |
"preact": "7.1.0", | |
"preact-compat": "3.14.1", | |
"proptypes": "0.14.4", | |
"glamor": "2.20.24" | |
} | |
} |
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 _preact = require("preact"); | |
var _preact2 = _interopRequireDefault(_preact); | |
var _preactCompat = require("preact-compat"); | |
var _preactCompat2 = _interopRequireDefault(_preactCompat); | |
var _proptypes = require("proptypes"); | |
var _proptypes2 = _interopRequireDefault(_proptypes); | |
var _glamor = require("glamor"); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
var s = (0, _glamor.css)({ fontSize: 12 }); | |
function Thing(_ref) { | |
var children = _ref.children; | |
var additionalStyle = _ref.additionalStyle; | |
return _preactCompat2.default.createElement( | |
"div", | |
(0, _glamor.css)(s, additionalStyle), | |
_preactCompat2.default.createElement( | |
"span", | |
null, | |
children | |
) | |
); | |
} | |
function X() { | |
return _preactCompat2.default.createElement( | |
"div", | |
null, | |
_preactCompat2.default.createElement( | |
Thing, | |
{ key: "1" }, | |
"View" | |
), | |
_preactCompat2.default.createElement( | |
Thing, | |
{ key: "2" }, | |
"View" | |
) | |
); | |
} | |
_preactCompat2.default.render(_preactCompat2.default.createElement(X, null), document.getElementById('app')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment