jitsi-party
jitsi-party copied to clipboard
Only pass in required state in components using redux's connect()
A bit of performance tuning. We are currently passing the full redux state as props into components that connect to the redux store, causing unnecessary re-renders. We should map the state to props that are actually required by each component. This isn't REALLY an issue currently because mostly everything just happens from the Room
parent component, but this would be good to do.
For example, in Navigation.jsx
:
export default connect(state => state, {
updateRoomAudio: reducers.updateRoomAudioActionCreator
})(Navigation)
The first connect param should change to something like:
({ currentRoom, room }) => { currentRoom, room}
Since that's the only state we care about. Sometimes we also don't want to subscribe to any state updates at all, in which case we can just pass in null
.