Next.js library to manage navigation between pages/routes with loading animation
npm install nextjs-progressloader- A next Js Loading Bar component made using Nprogress. Works with Next.js 13 and whatever another version.
- Advanced feature: Navigate between routes with loading animation using our custom useRouter()
- Check the changelog
Important context: Latter the Next.Js 13 update, router events has ben depreciated and still there's no 'next native resource' to manipulate router events as before. But this lib was build to solve this problem and bring a new way to make the UX/UI better!
 
``bash
npm install nextjs-progressloader
yarn add nextjs-progressloader
`
Import the animation component:
`js`
import { ProgressLoader } from 'nextjs-progressloader';
For rendering add to your return() inside the
tag of RootLayout():`js
'use client';
import { ProgressLoader } from 'nextjs-progressloader';export default function RootLayout({ children }) {
return (
{children}
);
}
`##### Learn more about
Advanced Usage
If you would like to render some route with the Load Animation, use
component and our custom useRouter() hook to do it:When render
you are required to pass a links prop which is responsible to create all the needed events to work.And when using
useRouter() a event will be emitted based on the function's param.- Important and required: To this feature work correctly, the
links prop and the function's parameter must be equals.
- You can render the component how many times you want and anywhere you want, being inside the
- Using the next will identify the routes and will pre-render: verify the documentationOnce the links are defined, you can invoke the route wherever and whenever you want using the nickname or href.
##### Learn everything about the Usability flow
$3
`jsx
import { useRouter, ContainerLink, ContainerLinkProps } from 'nextjs-progressloader';const links: ContainerLinkProps["links"] = [
{
href: "/",
nickname: "home",
},
{
href: "/posts",
nickname: "posts"
},
{
href: "/login",
},
];
export function ComponentIWantToRender(){
const router = useRouter()
function validateSomeThing(){
// your validation
//Example
if(userLogged){
// calling by the nickname
router.push("home")
}else{
//calling by the route
router.push("/login")
}
}
return (
<>
;
>
)
}
``##### Learn everything about the Usability flow
##### Do you have any suggestions or issue? Please let me know
##### Check the changelog