Skip to content

Usage with next-useQueryState #23

@MrLoh

Description

@MrLoh

Is your feature request related to a problem? Please describe.
Nifty little library, thanks a lot. I would like to use it together with next-useQueryState aka nuqs which handles syncing state with query params, but I can't use the modified useRouter of this library for that.

Describe the solution you'd like
I have the current slightly hacky hook in my app that can be used with the loading state returned from useTransition from which the startTransition function is handed to the parser options which works but is a little hacky.

// eslint-disable-next-line import/no-extraneous-dependencies -- from next13-progressbar
import NProgress from 'nprogress';
import { useEffect } from 'react';

export const useShowNavLoadingBar = (loading: boolean) => {
  useEffect(() => {
    if (loading) NProgress.start();
    return () => {
      NProgress.done();
    };
  }, [loading]);
};

It would be nice to include something like this in the library to trigger the NProgress bar imperatively or with a hook. Maybe just exporting the NProgress object from the library would be an option.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions