Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage with next-useQueryState #23

Open
MrLoh opened this issue Jan 31, 2024 · 0 comments
Open

Usage with next-useQueryState #23

MrLoh opened this issue Jan 31, 2024 · 0 comments
Assignees

Comments

@MrLoh
Copy link

MrLoh commented Jan 31, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants