Questions tagged [next-link]

No instructions have been provided for this tag … at the moment!

Navigating pages using a dropdown menu in NEXT.js

Looking to navigate to different pages based on dropdown selection, but unsure how to do so in React and Next. "use client" import Link from 'next/link'; function Home() { return ( <main> <h1>Hello</h1> < ...

Tips for utilizing the next link href based on a specific condition

The following code snippet is causing me some trouble: <a onClick={() => { if (fortype === "user") { if (rd.track !== null) { router.push({ pathname: `/tracks/${rd.track._id}`, query: { fr ...

Creating NextJS Route with Dynamic Links for Main Page and Subpages

In my NextJS project, I have dynamic pages and dynamic subpages organized in the following folders/files structure: pages ├── [Formation] ├── index.js │ ├── [SubPage].js Within index.js (Formation Page), I create links like this: < ...

Ways to address unusual actions from Next/Link when used within a button

I am encountering some issues with the next/link functionality in my application. There is a reusable component that displays a button, which is used twice on the page with different URLs each time. While the button works perfectly when the page is viewe ...

How to Avoid 404 Errors When Using Next/Link in the App Directory

Here is a snippet of my NavBar() {/* Desktop Nav */} <div className="hidden md:flex items-center space-x-6"> <Link href={item1Href}> <div className="text-lg hover:text-gray-400">{i ...

React.js reusable component fails to update when a dependency library used in useEffect() undergoes a change

One of the components I've created in Next.js is a custom routing link that appends the locale before the pathname when clicked and applies a custom style for the active link. Below is the code snippet for this component: "use client"; imp ...

Challenge with concatenating Nextjs Links

I am encountering an issue with the Next/Link component. The problem arises when a user reaches the product details page. On the homepage, there are 3 link components that direct users to domain.com/headphones, domain.com/earphones, or domain.com/speakers. ...

What is the best way to display the Link above my custom component?

How can I ensure that the Link appears above the component I created in Next.js 11 version? I encountered this error message: Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()? ...

Is there a way to enclose hashtags and Twitter usernames in a link?

Currently, I'm developing an application that allows users to create posts and mention other users by using hashtags in the post. When retrieving the list of posts through an API call, the challenge arises on how to wrap these hashtags and usernames w ...