Skip to content

Fix nested <a> elements in ContributorCard.jsx component causing hydration warning #558

@Rohan-Ver-ma

Description

@Rohan-Ver-ma

Reproduction steps

While running the project locally, a console warning appears related to invalid HTML structure:

Image

This warning occurs because the ContributorCard component wraps the entire card with Gatsby’s component while also rendering social media links (GitHub, LinkedIn, Twitter) using tags inside the card.

Since Gatsby’s component renders an element internally, this results in nested anchor elements in the DOM.

Expected Results

Fixing this issue is important because:

  • It removes invalid HTML structure ( inside ).
  • It resolves hydration warnings in the browser console.
  • It improves accessibility and DOM correctness.
  • It prevents potential issues with React hydration and client-side rendering.
  • It ensures the component follows best practices for link handling in React/Gatsby.

Actual Results

Restructure the ContributorCard component so that the profile wraps only the card content, while external social links remain outside the element. This prevents nested anchor tags while preserving navigation behavior.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions