1.0.15 • Published 7 months ago

next-app-nprogress-navigation v1.0.15

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

next-app-nprogress-navigation

Customize next/link and next/navigation, make Nprogress working with NextJS 13 App dir just like NextJS 12

How to use

install package

npm install next-app-nprogress-navigation

or

yarn add next-app-nprogress-navigation

or

pnpm install next-app-nprogress-navigation

import Nprogress's css

src/app/globals.css

@import url("nprogress/nprogress.css");

use NavigationEvents on root layout

src/app/layout.tsx

import "./globals.css";
import { NavigationEvents } from "next-app-nprogress-navigation";
import { Suspense } from "react";
export default function RootLayout({
  children,
}: {
  children: React.ReactNode,
}) {
  return (
    <html>
      <body>
        {children}
        <Suspense fallback={null}>
          <NavigationEvents />
        </Suspense>
      </body>
    </html>
  );
}

use <NextLink /> from "next-app-nprogress-navigation" instead of <Link /> from 'next/link'

import { NextLink } from "next-app-nprogress-navigation";
export default function HomePageLink() {
  return <NextLink href="/">Home Page</NextLink>;
}

use useNextRouter from "next-app-nprogress-navigation" instead of useRouter from 'next/navigation'

"use client";
import { useNextRouter } from "next-app-nprogress-navigation";
export default function FooBarLink() {
  const router = useNextRouter();
  return (
    <button
      type="button"
      onClick={() => {
        router.push("/foo/bar");
      }}>
      Go To Foo Bar
    </button>
  );
}
1.0.15

7 months ago

1.0.14

7 months ago

1.0.13

10 months ago

1.0.11

10 months ago

1.0.10

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago