mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-25 21:15:26 +08:00
23 lines
443 B
TypeScript
23 lines
443 B
TypeScript
import * as React from 'react';
|
|
|
|
/**
|
|
* Component which prevents updates for children if no props changed
|
|
*/
|
|
function StaticContainer(props: any) {
|
|
return props.children;
|
|
}
|
|
|
|
export default React.memo(StaticContainer, (prevProps: any, nextProps: any) => {
|
|
for (const prop in prevProps) {
|
|
if (prop === 'children') {
|
|
continue;
|
|
}
|
|
|
|
if (prevProps[prop] !== nextProps[prop]) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
});
|