New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

next-styled-link

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-styled-link

Next.js Link component to be styled with styled-components

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

The problem

When you style a link with styled component you loose the href="…" meaning that there is no "open in a new tap" and no SEO for indexing links.

Example:

const StyledLink = styled.a`
  color: red;
  background: blue;
`

export default () => (
  <Link prefetch href={'index'}>
    <StyledLink>My styled link</StyledLink>
  </Link>
)

In this example above Zeit Next.js Link will not pass the href to the styled-component StyledLink.

Because in the render function of source of the next/link we found this:

if (child.type === 'a' && !('href' in child.props)) {

Styled components are not child.type = a.

Usage

const Link = require('next-styled-link');

Keywords

Next.js

FAQs

Package last updated on 06 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts