Next.js Discord

Discord Forum

When I navigate to another page there is a delay of 3 to 5 seconds, how do I resolve this?

Unanswered
Common paper wasp posted this in #help-forum
Open in Discord
Common paper waspOP
I am using the App Router

In my header I navigate like this:
const router = useRouter();
 
<MyButton onClick={() => router.push("/budget")} ></MyButton>

My budget page is simple, it just has my form with my inputs
import styles from "./paeg.module.css";
import CompContainer from "./compositions/compContainer";
import { Metadata } from "next";

export const metadata: Metadata = {
    title: "Orçamento"
}

export default function Buldget() {
    return (
        <div className={styles.budget}>
            <CompContainer />
        </div>
    )
}

3 Replies

Long-legged ant
use the link component and see if it fixes your issues
Common paper waspOP
@Long-legged ant @Somali I did a test using the Link component and had the same problem
<Link href={"/budget"}>
       <FaWhatsapp />
       Orçamento
</Link>

I searched the forum and found this: Development mode (next developer) is much slower because routes are not pre-built.
https://stackoverflow.com/questions/65146878/nextjs-router-seems-very-slow-compare-to-react-router

I ended up discovering that this only happens in developer mode. I built the project and then started it with npm run start and I didn't encounter the delay issue when navigating to another page.