diff --git a/examples/with-styled-components/README.md b/examples/with-styled-components/README.md index 40670351f7a95..daff556fdfa36 100644 --- a/examples/with-styled-components/README.md +++ b/examples/with-styled-components/README.md @@ -33,54 +33,3 @@ Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&ut ### Try it on CodeSandbox [Open this example on CodeSandbox](https://codesandbox.io/s/github/vercel/next.js/tree/canary/examples/with-styled-components) - -### Notes - -When wrapping a [Link](https://nextjs.org/docs/api-reference/next/link) from `next/link` within a styled-component, the [as](https://styled-components.com/docs/api#as-polymorphic-prop) prop provided by `styled` will collide with the Link's `as` prop and cause styled-components to throw an `Invalid tag` error. To avoid this, you can either use the recommended [forwardedAs](https://styled-components.com/docs/api#forwardedas-prop) prop from styled-components or use a different named prop to pass to a `styled` Link. - -
-Click to expand workaround example -
- -**components/StyledLink.js** - -```javascript -import Link from "next/link"; -import styled from "styled-components"; - -const StyledLink = ({ as, children, className, href }) => ( - - {children} - -); - -export default styled(StyledLink)` - color: #0075e0; - text-decoration: none; - transition: all 0.2s ease-in-out; - - &:hover { - color: #40a9ff; - } - - &:focus { - color: #40a9ff; - outline: none; - border: 0; - } -`; -``` - -**pages/index.js** - -```javascript -import StyledLink from "../components/StyledLink"; - -export default () => ( - - First post - -); -``` - -