
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
nextjs-progressloader
Advanced tools
Next.js library to manage navigation between pages/routes with loading animation
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!
npm install nextjs-progressloader
yarn add nextjs-progressloader
Import the animation component:
import { ProgressLoader } from 'nextjs-progressloader';
app/layout.js
for app
folder structureFor rendering add <ProgressLoader />
to your return()
inside the <body></body>
tag of RootLayout()
:
'use client';
import { ProgressLoader } from 'nextjs-progressloader';
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
<ProgressLoader />
{children}
</body>
</html>
);
}
<ProgressLoader />
If you would like to render some route with the Load Animation, use <ContainerLink />
component and our custom useRouter()
hook to do it:
When render <ContainerLink />
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.
links
prop and the function's parameter must be equals.<body></body>
<ContainerLink />
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.
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 (
<>
<ContainerLink links={links} />;
<button className="bg-red-500" onClick={validateSomeThing}>
Validating something
</button>
</>
)
}
v1.3.0
FAQs
Next.js library to manage navigation between pages/routes with loading animation
The npm package nextjs-progressloader receives a total of 1,349 weekly downloads. As such, nextjs-progressloader popularity was classified as popular.
We found that nextjs-progressloader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.