admin管理员组文章数量:1296505
In my production, when we hover over whatever link in the application, the XHR request will send to the server. Therefore I need to prevent that option.
I used prefetch={false}
it doesn't work. Any solution for this issue?
<Link href={`${path}${card.post_details.slug}`} prefetch={false}>
Read More
</Link>
In my production, when we hover over whatever link in the application, the XHR request will send to the server. Therefore I need to prevent that option.
I used prefetch={false}
it doesn't work. Any solution for this issue?
<Link href={`${path}${card.post_details.slug}`} prefetch={false}>
Read More
</Link>
Share
Improve this question
edited Apr 28, 2023 at 9:07
Youssouf Oumar
46.3k16 gold badges101 silver badges104 bronze badges
asked Jan 8, 2023 at 11:06
IrushanIrushan
1552 silver badges12 bronze badges
0
2 Answers
Reset to default 9prefech={false}
disable prefetching in all scenarios but not on hover, as you can read on the doc:
When prefetch is set to false, prefetching will still occur on hover.
In this GitHub issue, one of the mainters says about a pull request he made about prefech
:
To be precise, only the new router for https://nextjs/blog/layouts-rfc will disable prefetching on hover. For the existing router, it is still relevant to do prefetching on hover as it is not a single pass to load code and data.
So if this is so important to you, maybe try migrating to Next 13, and use the app
directory.
am facing same issue i add experimental: { optimisticClientCache: false, } in next.config file.It works for me
本文标签: javascriptHow can turn off page prefetching Nextjs Link on hoverStack Overflow
版权声明:本文标题:javascript - How can turn off page prefetching Next.js Link on hover? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741631312a2389382.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论