next-nprogress

Next.js HOC to integrate NProgress inside your app

Github星跟蹤圖

next-nprogress

Next.js HOC to integrate NProgress inside your app.

This is configured to run only after a delay of (default) 300ms. This means if the page change takes too long it will render the progress bar, but if it's fast enough it will avoid rendering it.

Installation

yarn add next-nprogress

Usage

Component

Import it inside your pages/_app.js;

import NProgress from "next-nprogress/component";

Render the component in your custom App container:

<NProgress />

That's it. Now NProgress will work automatically and render the correct styles using styled-jsx.

Higher order component

Import it inside your pages/_app.js;

import withNProgress from "next-nprogress";

Wrap your custom App container with it

const msDelay = 1000; // default is 300
export default withNProgress(msDelay)(MyApp);

Internally it will use the NProgress component and render it alongside your application.

Advanced Config

You can configure further configure NProgress using its configuration options.

Configure the component:

<NProgress
  color="#29d"
  options={{ trickleSpeed: 50 }}
  showAfterMs={300}
  spinner
/>

Configure the HOC:

const msDelay = 200;
const options = { trickleSpeed: 50 };
export default withNProgress(msDelay, options)(MyApp);

主要指標

概覽
名稱與所有者sergiodxa/next-nprogress
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2018-06-21 22:38:51
推送於2019-08-10 14:59:36
最后一次提交2019-03-06 17:30:08
發布數5
最新版本名稱1.4.0 (發布於 )
第一版名稱1.0.2 (發布於 )
用户参与
星數148
關注者數3
派生數14
提交數85
已啟用問題?
問題數13
打開的問題數0
拉請求數72
打開的拉請求數0
關閉的拉請求數18
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?