mirror of
https://github.com/zhigang1992/react.git
synced 2026-04-29 12:45:32 +08:00
chore: avoid memo override exported component displayName
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user