React Base Fiddle (JSX)
Starting point for creating JSFiddles with React.
HTML
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/[email protected]/dist/style-it-standalone.js"></script>
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
Babel + JSX
class ParentComponent extends React.Component {
render() {
const fontSize = 40;
return Style.it(`
.intro {
font-size: ${ fontSize }px;
}
`,
<ChildComponent>
<p className="intro">
<b className="package">Reactive Style</b> has many of the benefits of
inline styling like: scoping, ↑ cohesion, and ↓ coupling of files --
<i>without</i> the sacrifices of Reacts inline styling.
</p>
</ChildComponent>
);
}
}
class ChildComponent extends React.Component {
render() {
return Style.it(`
.child {
color: red;
}
`,
<div className={this.props.className}>
{this.props.children}
</div>
);
}
}
ReactDOM.render(
<ParentComponent />,
document.getElementById('container')
);