Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate automatic insertion of <a> for <Link> #796

Closed
rauchg opened this issue Jan 16, 2017 · 2 comments
Closed

Deprecate automatic insertion of <a> for <Link> #796

rauchg opened this issue Jan 16, 2017 · 2 comments

Comments

@rauchg
Copy link
Member

rauchg commented Jan 16, 2017

It's an anti-pattern. I'd like <Link> to only be an abstract higher-order component that decorates whatever is inside

@tpreusse
Copy link
Contributor

tpreusse commented Jan 19, 2017

Currently when using styled-components one needs a pretty odd setup:

import NextLink from 'next/prefetch'
import styled from 'styled-components'

const Link = ({children, className, ...props}) => (
  <NextLink {...props}><a className={className}>{children}</a></NextLink>
)

export default styled(Link)`
  color: tomato;
`

Using a styled.a (or anything else that maps href to an a) inside NextLink is not possible because it will fail the child.type test. Maybe remove all the magic and checking completely and add a warning in some other way? Maybe in the onClick handler?

@timneutkens
Copy link
Member

@tpreusse please see #816

@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants