Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Commit

Permalink
fix: get rid of console error from using ref on SFC (#1969)
Browse files Browse the repository at this point in the history
* fix: get rid of console error from using ref on SFC

* fix(ui-shell): add displayName for ui-shell link
  • Loading branch information
davidicus authored and asudoh committed Mar 6, 2019
1 parent eee997c commit 960fee4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/UIShell/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import React from 'react';
* in their own components to support use-cases like `react-router` or
* `@reach/router`
*/
const Link = ({ element, ...rest }) => {
return React.createElement(element, rest);
};
const Link = React.forwardRef((props, ref) => {
const { element, ...rest } = props;
return React.createElement(element, { ...rest, ref });
});

const LinkPropTypes = {
/**
Expand All @@ -30,8 +31,8 @@ const LinkPropTypes = {
]),
};

Link.displayName = 'Link';
Link.propTypes = LinkPropTypes;

Link.defaultProps = {
element: 'a',
};
Expand Down

0 comments on commit 960fee4

Please sign in to comment.