JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.0/react-dom.min.js"></script>
<body>
<div id="app"></div>
</body>
JavaScript
class Mine {
constructor() {
this.x = 123;
}
meth() {}
}
let MyElement = React.createClass({
doIt: function() {
let m = new Mine();
this.setState(m, () => {
console.log('1:', m instanceof Mine, m.x, m.meth);
console.log('2:', this.state instanceof Mine, this.state.x, this.state.meth);
});
},
render: function() {
return React.createElement('button', {onClick: this.doIt}, 'do it');
}
});
ReactDOM.render(
React.createElement(MyElement),
document.getElementById('app')
);