1. export default function memo<Props>(
    2. type: React$ElementType,
    3. compare?: (oldProps: Props, newProps: Props) => boolean,
    4. ) {
    5. // 根据传入的比较函数来决定是否 rerender
    6. return {
    7. $$typeof: REACT_MEMO_TYPE,
    8. type,
    9. compare: compare === undefined ? null : compare,
    10. };
    11. }