JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.18/require.min.js"></script>
<div id="content"></div>
JavaScript
require.config({
paths: {
"react": 'https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.min',
"react-inline-style": "http://dowjones.github.io/react-inline-style/dist/react-inline-style",
}
})
require(["react", "react-inline-style"], function (react, reactInlineStyle) {
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//var React = require("react");
//var Style = require("react-inline-style");
var React = react;
var Style = reactInlineStyle;
///////////////////////////////////////////////////////////////////////////////
Style = Style.define({
textComponent: {
fontWeight: "bold",
fontStyle: "italic"
},
hovering: {
color:"red"
},
pressing : {
color:"blue"
}
});
var TextComponent = React.createClass({
mixins: [Style()],
click: function () {
this.style.define({
textComponent: {
fontStyle: "normal",
letterSpacing: "2px"
}
});
this.forceUpdate();
},
render: function () {
return React.createElement("p", {
style: this.style("textComponent", "hovering:hover", "pressing:pressed"),
onClick: this.click
},
"textComponent");
}
});
React.render(
React.createElement(TextComponent),
document.getElementById("content")
);
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
});