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

<a> cannot appear as a descendant of <a> #57

Open
joshball opened this issue Aug 31, 2020 · 0 comments
Open

<a> cannot appear as a descendant of <a> #57

joshball opened this issue Aug 31, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@joshball
Copy link

Checking out a new hacker starter, and rendering the index page (https://github.com/Chronoblog/gatsby-theme-chronoblog/blob/master/starters/hacker/src/pages/index.mdx) you will receive an error in the console of chrome:

index.js:2177 Warning: validateDOMNesting(...): <a> cannot appear as a descendant of <a>.
    in a (created by Context.Consumer)
    in Styled(div) (created by ForwardRef)
    in ForwardRef (at root.js:39)

It appears that the code in root.js

const Link = ({ to, children, ...props }) => (
  <LinkGatsby to={to} {...props}>
    <LinkThemeUi>{children}</LinkThemeUi>
  </LinkGatsby>
);

Is creating two anchors when using Link in the MDX. For instance, in index.mdx:

<h3>
  Posts and Articles / <Link to='posts-and-articles'>All of Them</Link>
</h3>

Not exactly sure how to combine GatsbyLinks with the LinkThemeUI, or I would create a PR.
Maybe something like using <LinkThemeUI as={LinkGatsby} or LinkGatsby as={LinkThemeUI}

Thoughts?

@ganevdev ganevdev added the bug Something isn't working label Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants