React Base Fiddle (JSX)
Starting point for creating JSFiddles with React. This uses React with Addons.
by ifandelse
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://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/machina.js/2.0.0/machina.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/postal.js/1.0.8/postal.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.13.0/polyfill.js"></script>
<script src="https://rawgit.com/ifandelse/lux.js/feature-store-wrapper/lib/lux.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration-babel.js"></script>
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
JavaScript 1.7
var muhStore = new lux.Store({
namespace: "person",
state: { name: "UNKNOWN" },
handlers: {
setName: function( name ) {
this.setState({ name: name });
}
}
});
var Hello = React.createClass({
onSomeThing: function() {
this.props.onSetName("Ryan");
},
render: function() {
return <div onClick={ this.onSomeThing }>Hello {this.props.name}</div>;
}
});
var LuxContainer = lux.LuxContainer;
var onChangeHandler = function( props ) {
return { name: muhStore.getState().name }
};
ReactDOM.render(
<LuxContainer
stores="person"
onStoreChange={ onChangeHandler }
actions={ { onSetName: "setName" } }
>
<Hello name="Jimbo" />
</LuxContainer>,
document.getElementById('container')
);