I want to check whether a certain prop changed manually, then use React's built-in comparison function for the other props. E.g.:
React.memo(
() => <div />,
(prevProps, nextProps) => {
if (!nextProps.visible) {
return true;
}
return React.shallowCompare(prevProps, nextProps);
},
);
I can easily write my own comparison function or copy/paste from React's source, but if React changes their default comparison function then I'd have to manually change my function too. Is there a way to use React's built-in comparison function for React.memo
?
Also, AFAIK, react-addons-shallow-compare
is outdated.