Skip to content

Instantly share code, notes, and snippets.

@remy

remy/Layout.js Secret

Last active November 5, 2018 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remy/8f345e8e2f9136a721dff5f1925c773f to your computer and use it in GitHub Desktop.
Save remy/8f345e8e2f9136a721dff5f1925c773f to your computer and use it in GitHub Desktop.
Add the following to the top of your Layout.js componet
import NProgress from 'nprogress';
import router from 'next/router';
router.onRouteChangeStart = () => NProgress.start();
router.onRouteChangeComplete = () => NProgress.done();
router.onRouteChangeError = () => NProgress.done();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment