admin管理员组文章数量:1392003
I use NextJS Link component for routing.
Also, I use useTransition for server actions.
The problem is that mid-transition, the Link component does not link.
Furthermore, the transition never ends when the transition action is an API call - because the call is cancelled I assume.
I created a POC for this issue:
What is the best practice for preventing this behavior?
I use NextJS Link component for routing.
Also, I use useTransition for server actions.
The problem is that mid-transition, the Link component does not link.
Furthermore, the transition never ends when the transition action is an API call - because the call is cancelled I assume.
I created a POC for this issue:
https://github/OrenSayag/next-link-mid-transition-issue/tree/main
What is the best practice for preventing this behavior?
Share Improve this question asked Mar 12 at 15:18 Oren SayagOren Sayag 411 silver badge6 bronze badges 01 Answer
Reset to default 0We have decided to use react-query lib instead of useTransition.
I conclude we were wrong using useTransition for api calls, as the react-query lib provides so much more than just a pending state for this use case.
useTransition is useful for UI intensive tasks, or background UI tasks, but not so much for api calls.
本文标签:
版权声明:本文标题:reactjs - In nextjs, using react's useTransition, next's Link is not working mid transition. Best practice for p 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744745345a2622842.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论