diff --git a/packages/react-web/package.json b/packages/react-web/package.json index 7d4022c776..4dacb3d142 100644 --- a/packages/react-web/package.json +++ b/packages/react-web/package.json @@ -1,6 +1,6 @@ { "name": "@plasmicapp/react-web", - "version": "0.2.90", + "version": "0.2.91", "description": "plasmic library for rendering in the presentational style", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/react-web/src/render/PlasmicLink.tsx b/packages/react-web/src/render/PlasmicLink.tsx index 809418e2da..9bd12339ab 100644 --- a/packages/react-web/src/render/PlasmicLink.tsx +++ b/packages/react-web/src/render/PlasmicLink.tsx @@ -1,7 +1,10 @@ import React from "react"; import { omit, pick } from "../common"; -export function PlasmicLink(props: any) { +export const PlasmicLink = React.forwardRef(function PlasmicLink( + props: any, + ref: React.Ref +) { // props.href is required for nextjs; if no props.href, // then we just render the default anchor element if (props.platform === "nextjs" && props.href) { @@ -18,19 +21,19 @@ export function PlasmicLink(props: any) { return React.createElement( props.component, pick(props, ...nextjsProps), - + ); } if (props.platform === "gatsby" && isInternalHref(props.href)) { return React.createElement(props.component, { ...omit(props, "component", "platform", "href"), - ...{ to: props.href }, + ...{ to: props.href, ref }, }); } - return ; -} + return ; +}); function isInternalHref(href: string): boolean { return /^\/(?!\/)/.test(href);