Merge pull request #7543 from SDA-SE/feat/muiref

Resolve a warning in `<Button>` related to not using `React.forwardRef`
This commit is contained in:
Oliver Sand
2021-10-11 13:50:52 +02:00
committed by GitHub
2 changed files with 8 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-components': patch
---
Resolve a warning in `<Button>` related to not using `React.forwardRef`.
@@ -43,7 +43,9 @@ declare function ButtonType(props: ButtonProps): JSX.Element;
/**
* This wrapper is here to reset the color of the Link and make typescript happy.
*/
const LinkWrapper = (props: LinkProps) => <Link {...props} color="initial" />;
const LinkWrapper = React.forwardRef<any, LinkProps>((props, ref) => (
<Link ref={ref} {...props} color="initial" />
));
const ActualButton = React.forwardRef<any, ButtonProps>((props, ref) => (
<MaterialButton ref={ref} component={LinkWrapper} {...props} />