This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// component with layout | |
var Link = React.createClass({ | |
mixins: [LayoutMixin] | |
render: function () { | |
<span> | |
{this.props.children[0]} | |
{this.transferPropsTo(<a>{this.props.children[1]}</a>)} | |
{this.props.children[2]} | |
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx React.DOM */ | |
var MyRootComponent = React.createClass({ | |
getInitialState: function() { | |
return {perMinute: '-', perDay: '-'}; | |
}, | |
componentDidMount: function() { | |
var socket = io.connect(this.props.url); | |
socket.on('business.clickout', this.setState.bind(this)); | |
}, | |
render: function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx React.DOM */ | |
var MyComponent = React.createClass({ | |
getInitialState: function() { | |
// set up the initial state. used for "logical" initialization code | |
return {perMinute: '-', perDay: '-'}; | |
}, | |
componentDidMount: function() { | |
// fired only once, when the component is added to the DOM | |
// used for initialization code that has "side effects" i.e. i/o, jquery plugins, etc | |
var socket = io.connect(this.props.url); |