I'm new to react. So for me when some react states get updated. All other state change event inside my return function gets called.
For example :
My State :
state = {
isLogined : false,
redirect: false,
username: "",
avatar : '',
name : '',
messages : [],
feeds : [],
activechat : {},
currentRoom : '',
}
So I'm listening a firebase database with child_added event and updating my feeds state by using the following code,
this.setState({
feeds : topics
})
It works fine for the feeds component. But all other component associated with other states are getting called again,
<HomeBar avatar={this.state.avatar} />
and
<Card className={"middleContainer"}>
{this.getChatBox(this.state.activechat)}
</Card>
So how can i fix that :(
Pastebin for Home and HomeBar