JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://fb.me/react-with-addons-0.8.0.js"></script>
<script src="http://fb.me/JSXTransformer-0.8.0.js"></script>
<script src="http://fb.me/react-js-fiddle-integration.js"></script>
JavaScript 1.7
/** @jsx React.DOM */
var Hello = React.createClass({
getInitialState: function() {
return { values: [
{type: "translateX", x: 10},
{type: "scaleX", x: 1.2}
]}
},
handleTypeChange: function(i, value) {
this.state.values[i].type = value
this.setState({ values: this.state.values })
},
render: function() {
return <div>
{this.state.values.map(function(item, i) {
var typeLink = {
value: this.state.values[i].type,
requestChange: this.handleTypeChange.bind(null, i)
}
return <div>
<input valueLink={typeLink}/>
<input value={this.state.values[i].x}/>
</div>
}, this)}
<pre>{JSON.stringify(this.state)}</pre>
</div>;
}
});
React.renderComponent(<Hello name="World" />, document.body);