Untitled

mail@pastecode.io avatar
unknown
tsx
2 years ago
460 B
5
Indexable
import TopBarProgress from 'react-topbar-progress-indicator';
// show progress-bar before change route
TopBarProgress.config({
    barColors: { 0: '#0b84b3' },
});
const [topProgressBar, setTopProgressBar] = useState<boolean>(false);
Router.events.on('routeChangeStart', (): void => {
    setTopProgressBar(true);
});
Router.events.on('routeChangeComplete', (): void => {
    setTopProgressBar(false);
});

{topProgressBar && <TopBarProgress />}