Skip to content

Instantly share code, notes, and snippets.

@Hypnosphi
Last active May 25, 2017 18:42
Show Gist options
  • Save Hypnosphi/5ca481cf3de9cedd060bb6729f4ff983 to your computer and use it in GitHub Desktop.
Save Hypnosphi/5ca481cf3de9cedd060bb6729f4ff983 to your computer and use it in GitHub Desktop.
esnextbin sketch
<!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>
// 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'
import styled from 'styled-components'
const Link = (props) => (
<a {...props}/>
)
const StyledLink = styled(Link).attrs({
foo: undefined
})`
color: palevioletred;
font-weight: bold;
`;
render(
<div>
<Link>Unstyled, boring Link</Link>
<br />
<StyledLink foo="FOO">Styled, exciting Link</StyledLink>
</div>,
document.getElementById('app')
);
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"react": "15.5.4",
"react-dom": "15.5.4",
"styled-components": "2.0.0",
"babel-runtime": "6.22.0"
}
}
'use strict';
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n\tcolor: palevioletred;\n\tfont-weight: bold;\n'], ['\n\tcolor: palevioletred;\n\tfont-weight: bold;\n']); // write ES2015 code and import modules from npm
// and then press "Execute" to run your program
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _styledComponents = require('styled-components');
var _styledComponents2 = _interopRequireDefault(_styledComponents);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Link = function Link(props) {
return _react2.default.createElement('a', props);
};
var StyledLink = (0, _styledComponents2.default)(Link).attrs({
foo: undefined
})(_templateObject);
(0, _reactDom.render)(_react2.default.createElement(
'div',
null,
_react2.default.createElement(
Link,
null,
'Unstyled, boring Link'
),
_react2.default.createElement('br', null),
_react2.default.createElement(
StyledLink,
{ foo: 'FOO' },
'Styled, exciting Link'
)
), document.getElementById('app'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment