1.0.0 • Published 2 years ago

nextjs-router-shallow v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

next-router-shallow

Shallow routing

Shallow routing allows you to change the URL without running data fetching methods again.

The Issue Tracker

https://github.com/vercel/next.js/discussions/48110

Installation

npm

npm install next-router-shallow

yarn

yarn add next-router-shallow

pnpm

pnpm add next-router-shallow

Usage

import { useRouter } from "next/navigation";
import "next-router-shallow";

export default function MyComponent() {
  const router = useRouter();
  
  const onClick = () => {
    router.shallow("/blog?search=shallow");
  };
  ...
}

!IMPORTANT
This import must be made in any file that uses the router.shallow() method.

1.0.0

2 years ago