Fix onError prop-type warning in Link (#8021)
The warning
> Warning: Failed prop type: Link: unknown props found: onError
can happen in this case:
```tsx
import * as React from 'react';
import NextLink, { LinkProps as NextLinkProps } from 'next/link';
type NextComposedProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & NextLinkProps;
const NextComposed = React.forwardRef<HTMLAnchorElement, NextComposedProps>((props, ref) => {
const { as, href, replace, scroll, passHref, shallow, prefetch, onError, ...other } = props;
return (
<NextLink
href={href}
prefetch={prefetch}
as={as}
replace={replace}
scroll={scroll}
shallow={shallow}
passHref={passHref}
onError={onError}
>
<a ref={ref} {...other} />
</NextLink>
);
});
```
*Taken from Material-UI Next.js integration example*
Showing
Please
register
or
sign in
to comment