NextJS error message: Failed prop type: The prop `href` expects a `str...
You must be signed in to create a new issue

closed

was closed 148 days ago

Issue Details

NextJS error message: Failed prop type: The prop `href` expects a `string` or `object` in `<Link>`, but got `undefined` instead

Solutions

Submitted by Tajwar Saiyeed

Instead of passing the link key directly into the Link's href prop:

<Link href={item.link} {...other props}>...</Link>

Pass it in string literals like this:

<Link href={`${item.link}`} {...other props}>...</Link>

You may wrap the children of the Link component in a <a> tag if you want but that's not required, and mine is working without that.


Stackoverflow

Submitted 239 days ago
T