-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Closed
Description
Bug report
When passing a next Link as a styled component to the dynamic routing feature, you receive an "Invariant Violation: Invalid tag: /post/second/second-comment" error. It seems that the dynamic-router is very explicitly looking for and is inflexible in allowing a styled-components wrapper to it.
To Reproduce
- Use the example from: https://github.com/zeit/next.js/tree/canary/examples/dynamic-routing
- Install styled-components library
- Open pages/post/[id]/index.js in your editor
- add the line
import styled from "styled-components" - Create a styled component using the next/link component with any styling you'd like.
const TestLink = styled(Link)cursor: pointer;`` - Replace any of the instances of with your TestLink version
- Check out the behavior in your browser.
Expected behavior
Expect to see the exact same dynamic route navigation behavior as the vanilla version of the example.
Additional context
I first ran into the issue on a separate project. After searching, I found the example linked above. With some trial and error, I narrowed down that the only difference between the example and my code was the use of styled components. I then verified that this was the cause by adding styled components to the dynamic-routing example.
Metadata
Metadata
Assignees
Labels
No labels