Warning: Prop `className` did not match.
See original GitHub issueI have been having this issue since last night, i did some research but couldn’t find any solution
I’m not using Material ui or Styled components
CustomLink
import { withRouter } from "next/router";
import Link from "next/link";
import React, { Children } from "react";
import cx from "classnames";
const ActiveLink = ({ router, children, ...props }) => {
const child = Children.only(children);
const className = cx(child.props.className, {
[props.activeClassName]: router.asPath === props.as && props.activeClassName
});
delete props.activeClassName;
return <Link {...props}>{React.cloneElement(child, { className })}</Link>;
};
export default withRouter(ActiveLink);
Nav.js
import "../../static/styles/Nav.scss";
const Nav = () => {
return (
<nav className="navbar">
<Link
href="/player?name=xXSARKURDZz&platform=psn"
as="/player/psn/xXSARKURDZz"
activeClassName="navbar__item-active"
>
<a className="navbar__item">Profile</a>
</Link>
<Link
href="/gambit?name=xXSARKURDZz&platform=psn"
as="/player/psn/xXSARKURDZz/gambit"
activeClassName="navbar__item-active"
>
<a className="navbar__item">Gambit</a>
</Link>
</nav>
);
};
export default Nav;
Issue Analytics
- State:
- Created 4 years ago
- Comments:35 (10 by maintainers)
Top Results From Across the Web
Warning: Prop `className` did not match. when using styled ...
That error is showing you the class that is being created by your styled-components library on the server and how it is different...
Read more >Warning: Prop className did not match. #7322 - GitHub
It appears to be an issue that backend generates styled component but client doesn't get it/doesn't use it and instead of using server...
Read more >Fixing ClassName did not match error - DEV Community
Warning : Prop `className` did not match. Server: Client: This is probably one of the most annoying problem with ...
Read more >Solving the Styled Components Warning in Next.JS with Babel
Warning : Prop `className` did not match. Server: “fs-fdsf” Client: “sd-dfasj”. The combination of Next.JS and Styled Components is truly ...
Read more >Prop `className` did not match - CodeSandbox
VS Code's tsserver was deleted by another application such as a misbehaving virus detection tool. Please reinstall VS Code. Manage Extension.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I fixed this issue editing my
.babelrcfile toThe solution is here: https://stackoverflow.com/a/61621949/7741752