#How does <Link> really work?

10 messages · Page 1 of 1 (latest)

pastel gulch
#

When I have <Link>s on the page. It seems like when I click the element, it doesnt change my browser url right away, it almost seems like it goes ahead and fetches that entire page and then reroutes. What am I missing to make it so that the page goes into my loading.tsx state while my server side logic finished fetching data?

For example, going from /work-queue?date=2023-09-20 to /work-queue?date=2023-09-21.

I have two ways of doing it. One where I have a button that is really a Link with styles.

The other way is when I click the date picker it will do a router.push("work-queue?date=new-date-here");

The page does take a bit to fetch the data. How can I make it so it displays my loading.tsx so the user knows what's going on....

What am I missing?

torn violetBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

vernal wadi
#

Does it have the same behavior in production build?

pastel gulch
#

yes, it does.

vernal wadi
#

Show code and explain better your structure

exotic yacht
#

so they should work the same way

#

the reason <Link> is preferred is because when js is disabled, it behaves like a normal <a>

#

and <Link> is SEO-friendly

oblique dirge
#

@exotic yacht Hi there, I search "Link SEO" and find this thread. Could you say more about "Link is SEO-friendly"? I have a bunch of Links in my landing page, and each Link routes to a different page on my website, so it's like <Link href='/california-hotels'> California </Link> <Link href='/new-york-hotels'> New York </Link> What I really want is that Google crawler can discover each of the pages i.e., www.mysite.com/california-hotels www.mysite.com/new-york-hotels But I am just afraid that it won't - I am sure if it's a tag, i.e., <a href="www.mysite.com/california-hotels">California</a> it will because the url is spelled out. Does the Google crawler have the ability to find the actual url when I use Link? Thank you