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>
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
CSS
.test { background: blue; }
Babel + JSX
class Hello extends React.Component {
render() {
var loading = true;
var ConditionalWrap = props => (loading ? <span className="test">{props.children}</span> : props.children);
return (
<ConditionalWrap>Hello World</ConditionalWrap>
);
}
}
ReactDOM.render(
<Hello />,
document.getElementById('container')
);