package
Enables Fast Refresh for remote data in NextJS.
npm install next-remote-refreshGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 4 packages.
383.1 kB
Includes dependencies.
Utilize Fast Refresh for remote data in Next.js. See the example for setup.
yarn add next-remote-refresh --devnpm install next-remote-refresh --save-devAdd and configure plugin in next.config.mjs:
// next.config.mjs
import { resolve } from 'node:path'
import createRemoteRefresh from 'next-remote-refresh'
const withRemoteRefresh = createRemoteRefresh({
paths: [resolve(__dirname, './package.json')],
ignored: '**/*.json',
})
export default withRemoteRefresh({ ...next config here })useRemoteRefresh hookAdd the useRemoteRefresh hook to the top-level component in your app. You may also configure when the app should refresh based on the changed path:
import { useRouter } from 'next/router'
import { useRemoteRefresh } from 'next-remote-refresh/hook'
import path from 'path'
function App({ name, version }) {
const router = useRouter()
useRemoteRefresh({
shouldRefresh: (path) => path.includes(router.query.slug),
})
return (
<div>
Package: {name} Version: {version}
</div>
)
}
export function
yarn install && yarn link
cd example
yarn install && yarn link next-remote-refresh
yarn devThanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
Fatih Kalifa 💻 📖 |
Jason Brown 📖 |
Paco 💻 |
Arnav Gosain 💻 |
Tim Davis 💻 |
Kyle Herock 💻 | Maggie Liu 💻 | Patrick Kerschbaum 💻 | Ajit 🤔 |