https://github.com/dczajkowski/nextjs-demo-with-loading
https://github.com/dczajkowski/nextjs-demo-with-loading
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dczajkowski/nextjs-demo-with-loading
- Owner: DCzajkowski
- Created: 2022-07-20T14:21:20.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-20T14:21:30.000Z (over 3 years ago)
- Last Synced: 2025-01-10T03:12:25.382Z (about 1 year ago)
- Language: JavaScript
- Homepage: nextjs-demo-with-loading.vercel.app
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example app with page loading indicator
Sometimes when switching between pages, Next.js needs to download pages(chunks) from the server before rendering the page. And it may also need to wait for the data. So while doing these tasks, the browser might be non responsive.
We can simply fix this issue by showing a loading indicator. That's what this examples shows.
It features:
- An app with two pages which uses a common [Header](./components/Header.js) component for navigation links.
- Using `next/router` to identify different router events
- Uses [nprogress](https://github.com/rstacruz/nprogress) as the loading indicator.
## Deploy your own
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-loading)
[](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-loading&project-name=with-loading&repository-name=with-loading)
## How to use
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
```bash
npx create-next-app --example with-loading with-loading-app
# or
yarn create next-app --example with-loading with-loading-app
# or
pnpm create next-app --example with-loading with-loading-app
```
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).