You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// With MixinvarWithLink=React.createClass({mixins: [React.addons.LinkedStateMixin],getInitialState: function(){return{message: 'Hello!'};},render: function(){return<inputtype="text"valueLink={this.linkState('message')}/>;}});// Move logic to a HOCvarWithLink=React.createClass({getInitialState: function(){return{message: 'Hello!'};},render: function(){return<inputtype="text"valueLink={LinkState(this,'message')}/>;}});
Detailed Example
// With MixinvarCarDataMixin={componentDidMount: {// fetch car data and// call this.setState({carData: fetchedData}),// once data has been (asynchronously) fetched}};varFirstView=React.createClass({mixins: [CarDataMixin],render: function(){return(<div><AvgSellingPricesByYearcountry="US"dataset={this.state.carData}/><AvgSellingPricesByYearcountry="UK"dataset={this.state.carData}/><AvgSellingPricesByYearcountry="FI"dataset={this.state.carData}/></div>)}});// With HOCvarbindToCarData=function(Component){returnReact.createClass({componentDidMount: {// fetch car data and// call this.setState({carData: fetchedData}),// once data has been (asynchronously) fetched},render: function(){return<ComponentcarData={this.state.carData}/>}});};// Then wrap your component when you define it.varFirstView=bindToCarData(React.createClass({render: function(){return(<div><AvgSellingPricesByYearcountry="US"dataset={this.props.carData}/><AvgSellingPricesByYearcountry="UK"dataset={this.props.carData}/><AvgSellingPricesByYearcountry="FI"dataset={this.props.carData}/></div>)}}));