React Base Fiddle (JSX)
Starting point for creating JSFiddles with React. This uses React with Addons.
by xufocoder
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js"></script>
<script src="https://npmcdn.com/react@latest/dist/react-with-addons.js"></script>
<script src="https://npmcdn.com/react-dom@latest/dist/react-dom.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration-babel.js"></script>
<div id="reactContainerElement"></div>
JavaScript 1.7
class Root extends React.Component {
render() {
return (
<div>
<Parent childName="Slim Shady" />
<hr />
<Parent childName="Michael Jackson" />
</div>
);
}
}
class Parent extends React.Component {
render() {
return (
<div>
<div>There's my child {this.props.childName}</div>
<Child name={this.props.childName} />
</div>
);
}
}
Parent.propTypes = {
childName: React.PropTypes.string
}
class Child extends React.Component {
render() {
return (
<div>Hi, I'm child and my name is {this.props.name}</div>
);
}
}
Child.propTypes = {
name: React.PropTypes.string
}
ReactDOM.render(
<Root />,
document.getElementById('reactContainerElement')
);