chore: avoid memo override exported component displayName

This commit is contained in:
unix
2020-04-29 15:11:49 +08:00
parent c53abeca7b
commit 869154175f
78 changed files with 325 additions and 239 deletions

View File

@@ -4,7 +4,7 @@ interface Props {
color?: string
}
export const LinkIcon: React.FC<Props> = React.memo(({ color }) => {
export const LinkIcon: React.FC<Props> = ({ color }) => {
return (
<svg viewBox="0 0 24 24" width="1em" height="1em" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"
strokeLinejoin="round" fill="none" shapeRendering="geometricPrecision" style={{ color }} className="icon">
@@ -21,6 +21,6 @@ export const LinkIcon: React.FC<Props> = React.memo(({ color }) => {
`}</style>
</svg>
)
})
}
export default LinkIcon
export default React.memo(LinkIcon)

View File

@@ -24,7 +24,7 @@ const defaultProps = {
type NativeAttrs = Omit<React.AnchorHTMLAttributes<any>, keyof Props>
export type LinkProps = Props & typeof defaultProps & NativeAttrs
const Link = React.memo(React.forwardRef<HTMLAnchorElement, React.PropsWithChildren<LinkProps>>(({
const Link = React.forwardRef<HTMLAnchorElement, React.PropsWithChildren<LinkProps>>(({
href, color, underline, pure, children, className, block, ...props
}, ref: React.Ref<HTMLAnchorElement>) => {
const theme = useTheme()
@@ -58,6 +58,8 @@ const Link = React.memo(React.forwardRef<HTMLAnchorElement, React.PropsWithChild
`}</style>
</a>
)
}))
})
export default withDefaults(Link, defaultProps)
const MemoLink = React.memo(Link)
export default withDefaults(MemoLink, defaultProps)