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/electron-css@0.14.4/dist/index.js">
</script>
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
<!-- Please `RUN` the example -->
Babel + JSX
const CSS = ElectronCSS.CSS;
const MediaQuery = ElectronCSS.MediaQuery;
const {px} = ElectronCSS.units;
const color = ElectronCSS.color;
const mobileOnly = MediaQuery({
maxWidth: px(480),
maxHeight: px(720)
})
const someStyle = CSS({
[mobileOnly]: {
color: color.darken(color.red, 0.5)
}
}, "somestyle");
class MyComp extends React.Component {
render() {
return <div className={someStyle}>
Hello {mobileOnly() ? 'Mobile' : 'Desktop'}
</div>;
}
}
ReactDOM.render(
<MyComp />,
document.getElementById('container')
);