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
{{ message }}
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
We should be able to just use 'PureComponent' for most of this. But any component that has an object as a prop will need to be put through a better function. NOTE: Lodash's isEqual function will work for all cases except when it needs to check functions. Functions are checked using instances. So for example this will always be flagged as Not Equal.
const filters = [
{
onChange: (value) => {//do something}
}
]
// ... in shouldComponentUpdate of a child component
_.isEqual(this.props, nextProps)
// => false
That's because the instance of that function is being changed every time. To combat this, I would suggest we use the below function to basically ignore functions in the comparison as they should really ever change. We could provide an additional Prop to disable the checking as well. This would be helpful so that our inputs don't need to be reconciled every time there is a change.
We should be able to just use 'PureComponent' for most of this. But any component that has an object as a prop will need to be put through a better function. NOTE: Lodash's
isEqual
function will work for all cases except when it needs to check functions. Functions are checked using instances. So for example this will always be flagged asNot Equal
.That's because the instance of that function is being changed every time. To combat this, I would suggest we use the below function to basically ignore functions in the comparison as they should really ever change. We could provide an additional Prop to disable the checking as well. This would be helpful so that our inputs don't need to be reconciled every time there is a change.
The text was updated successfully, but these errors were encountered: