Resolve a warning in <Button> related to not using React.forwardRef

Signed-off-by: Oliver Sand <oliver.sand@sda-se.com>
This commit is contained in:
Oliver Sand
2021-10-11 12:48:21 +02:00
parent 9faf634497
commit 81c2a1af86
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} />