NextJS prefetch functionality? #3052
-
I know we need to setup the NextUI prvider and pass router.push to use nextjs navigation. Antoher example is that I have the NextUI pro sidebar that use ListboxItems to display each navigation option. Which in the end becomes a tag. But no prefetch. How can we achive this functionality with NextUI? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I have spent a couple of hours now to search and test. We can user Then.. I realized the This is how I solved it with the
|
Beta Was this translation helpful? Give feedback.
I have spent a couple of hours now to search and test. We can user
router.prefetch(item.href);
But when the component re-renders for some reason. It triggers the prefetch again. We could use memoization etc.. but nahh..Then.. I realized the
as
prop.. NextUI shows once again why its the best UI-lib.This is how I solved it with the
ListBoxItem
for the sidebar, works as expected and it prefetch in production.