I am working on project with react Flux architecture. my controller view look like
var MyComponent = React.createClass({
getInitialState: function() {
return MyStore.getData();
},
render: function() {
return <ul className="navigation">
<UserControl/>
<NavigationBar change={this._onChange} messageCounter={this.state.data.score}/>
</ul>
},
_onChange: function() {
this.setState(Store.getData());
}
});
I have some nested views in the render function, and every change that made in some view will cause controller view render function to run. This cause render function of all nested components also to run, but the only change will be on the UserControl component. I don't need all the nested component's render function to run.
How can I fix it?
Is it behaviour of flux architecture?
How to decrease the times render function calls?