Next.js Page LoadingBar
Component used to display a css animated loading bar on top of the page
npm i next-page-loading-bar
Example Use with a Layout wrapper component
state = pageLoading: true { const children = thisprops return <div> <LoadingBar show=thisstatepageLoading /> <Navigation /> <div className="pageContent"> children </div> </div> } { this } { routerEvents routerEvents } { routerEvents routerEvents } { const currentUrl = windowlocationpathname + windowlocationsearch if url !== currentUrl this } { this }
Using withLoadingBar
to Wrapp Page or layout component to save on boilerplate
{ const children = thisprops return <div> <Navigation /> <div className="pageContent"> children </div> </div> }
This didn't quite workout like I wanted for some reason so I'll get to fixing it later
currently what happens is that the animation is triggered after page tranitions for some reason.