Questions tagged [next-link]
67 questions
1
vote
0 answers
MUI AppBar with next/link Button Click Issue
Using the MUI AppBar layout and next/link I am having an issue where only the link text results in a click being handled that results in navigation.
I am using what I believed to have been pretty standard code with the MUI AppBar found at…

stats
- 455
- 4
- 18
1
vote
1 answer
NextJS dynamic routing, is "as" really necessary?
Both links work exactly the same, do we really need to use the as, can't we use just the href?
import Link from 'next/link'
export default function () {
return (<>
WithOUT as
…
…

Paulo Fernando
- 3,148
- 3
- 5
- 21
1
vote
0 answers
nextjs force incompatible "href" and "as" attributes in next/Link
I have the following routes:
/categories/[categoryId]
/products/[productId]
/content/[contentId]
and I want to have SEO friendly URLs for them as follows:
https://example.com/category-name-c12345 - where c in c12345 is a constant…

paradox
- 634
- 5
- 13
1
vote
3 answers
NextJs doesn't rerun scripts
When I use the tag in NextJs to navigate between pages it doesn't rerun my scripts after changing pages. It only runs the scripts after the first page load or when I press reload. When using plain tags instead, it works fine because the…

Dan P
- 43
- 7
1
vote
1 answer
Render Custom Component Inside NextJS Link
Issue:
I have a component that should redirect users to a new page on click. I want to use Next's component to take care of the route change.
However, I've noticed that the Link component refuses to render if any of its children are not…

Sam
- 1,130
- 12
- 36
1
vote
2 answers
How to wrap hashtag and @username with next Link?
I am working on an application where users can create posts and can mention other users and use the #hashtag in the post. Through API call I get the list of post, now the question is how can we wrap hashtags and usernames with next.js Link component…

Anurag Tripathi
- 784
- 1
- 13
- 13
1
vote
1 answer
How to fix Typescript error on Next JS next/link element
The following code is throwing me this Typescript error:
Type 'string' is not assignable to type 'RouteOrQuery'.ts(2322)
nextjs-routes.d.ts(32, 5): The expected type comes from property 'href' which is declared here on type 'IntrinsicAttributes &…

Barry Horbal
- 375
- 1
- 3
- 9
1
vote
1 answer
How to add CSS or styled-components to Link tag in Next.js?
Cannot add styles in any way to next.js tag.
code:
import Link from "next/link";
import styles from "../Components.module.css";
export default function SubjectBTN({ lable, path }) {
return (
1
vote
1 answer
How to fix net::ERR_ABORTED 404 (Not Found) when callink api route using next/link in NextJS
I have created an api route to download a CSV file and I am getting this error when using Next Link. I cannot just switch to because then my application will not build, so my hands are tied. The component is simple
const DownloadCsvPage = () => {
…

seven
- 1,183
- 14
- 33
1
vote
0 answers
Why does using [element].click() on the client bypasses router in Next.JS?
We have a React application using Next.js. My understanding is NextLink works by adding a click event to the element, stopping normal navigation and letting the router handle it instead. For example:
Go…

Scribblemacher
- 1,518
- 1
- 16
- 31
1
vote
0 answers
Error: Image is missing required "src" property. Make sure you pass "src" in props to the `next/image` There is no problem when I use 'ımg'
product.jsx
There is no problem when I use ımg but I want to use Next/image
and my old code was link, I edited it as nextLink
import React from 'react'
import NextLink from 'next/link'
import { urlFor } from '../lib/client'
import Image from…

burak ozcan
- 27
- 2
1
vote
0 answers
How push history router without change URL
For example I have a form with three steps. I want that each step are in the history router but without changing de URL
Is it possible do it with Next Route or Next Link?

Guillermo Otegui
- 11
- 2
1
vote
0 answers
how to keep url query string values even on page refresh
I am using useRouter and Link, while navigating through my webapp. I attach query string to the links so that i can use the passed data of the query, in the page i am redirecting the user to. which works fine. however, on page reload / refresh, the…

jeho Ntanda
- 53
- 1
- 8
1
vote
1 answer
Nextjs Link concatenate issue
I am having an issue with the Next/Link component. My issue occurs when the user has reached the product details page. In the home page I have 3 link components that takes the user to either domain.com/headphones || domain.com/earphones ||…

Felipe
- 333
- 7
- 19