UNPKG

1.47 kBSource Map (JSON)View Raw
1{"version":3,"names":["React","StaticContainer","props","children","memo","prevProps","nextProps","prevPropKeys","Object","keys","nextPropKeys","length","key"],"sources":["StaticContainer.tsx"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Component which prevents updates for children if no props changed\n */\nfunction StaticContainer(props: any) {\n return props.children;\n}\n\nexport default React.memo(StaticContainer, (prevProps: any, nextProps: any) => {\n const prevPropKeys = Object.keys(prevProps);\n const nextPropKeys = Object.keys(nextProps);\n\n if (prevPropKeys.length !== nextPropKeys.length) {\n return false;\n }\n\n for (const key of prevPropKeys) {\n if (key === 'children') {\n continue;\n }\n\n if (prevProps[key] !== nextProps[key]) {\n return false;\n }\n }\n\n return true;\n});\n"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,CAAyBC,KAAzB,EAAqC;EACnC,OAAOA,KAAK,CAACC,QAAb;AACD;;AAED,4BAAeH,KAAK,CAACI,IAAN,CAAWH,eAAX,EAA4B,CAACI,SAAD,EAAiBC,SAAjB,KAAoC;EAC7E,MAAMC,YAAY,GAAGC,MAAM,CAACC,IAAP,CAAYJ,SAAZ,CAArB;EACA,MAAMK,YAAY,GAAGF,MAAM,CAACC,IAAP,CAAYH,SAAZ,CAArB;;EAEA,IAAIC,YAAY,CAACI,MAAb,KAAwBD,YAAY,CAACC,MAAzC,EAAiD;IAC/C,OAAO,KAAP;EACD;;EAED,KAAK,MAAMC,GAAX,IAAkBL,YAAlB,EAAgC;IAC9B,IAAIK,GAAG,KAAK,UAAZ,EAAwB;MACtB;IACD;;IAED,IAAIP,SAAS,CAACO,GAAD,CAAT,KAAmBN,SAAS,CAACM,GAAD,CAAhC,EAAuC;MACrC,OAAO,KAAP;IACD;EACF;;EAED,OAAO,IAAP;AACD,CAnBc,CAAf"}
\No newline at end of file