Next.js Discord

Discord Forum

link tag behaviour

Answered
Ring-necked Duck posted this in #help-forum
Open in Discord
Ring-necked DuckOP
e
Answered by Ring-necked Duck
I should check out astro
View full answer

83 Replies

Show your testing repository @Ring-necked Duck
Ring-necked DuckOP
what lol i don't have one, I just yeeted a useEffect in an existing codebase to test it
let me create-next-app for you then
@alfonsus ardani can you show your code too
Ring-necked DuckOP
ok got it up, its pushing to gh
Ring-necked DuckOP
fucking git
Sorry, the first had "disable cache" enabled
here as you can see its the same
Ring-necked DuckOP
this contains all the relevant code
the rest of the things just render that component or the page that it goes to
Why are you using <Link> tags?
Ring-necked DuckOP
Uh that's what i was talking about the entire time
Link tags allow next to do client side navigation right?
But in the dom they're just a tags
so I wanted to see if a manually added a tag in the dom is encompased by next's as well
Ring-necked DuckOP
And that's why research is important, now I know that in this circumstance, this is how things work?
Idk man being inquisitive is important
Link tags are custom components that render <a> tags. But it also contains other logic that are not present in the dom
I'm more particularly troubled with your wording than your admiring dedication for research
Ring-necked DuckOP
English is not my 1st language
Neither is mine
Ring-necked DuckOP
English is not my n-th language where n is the number of languages that you know
i only know 2
you said "react rendered an a tag, i clicked it, it did client side navigation"
I apologize that i confused you that infact this is technically correct
however what I was thinking at that time is
Ring-necked DuckOP
Its okay
Now time to break another custom component
yes you clicked an <a> tag but there is another internal logic on the <a> tag
thats not visible in the DOM
Ring-necked DuckOP
you thought i had an a tag in the code
rendered as in the jsx as input
but i was talking about the html that was rendered
Makes sense
Ugh i really wanted that to work for some reason
and when you said "I want to understand how <Link> works internally"
I really meant that this has nothing to do with <Link> but more about general understanding about React
yes you can do those type of magics but its not how components are usually made
a component should only care for itself and not others. so a custom component is typically designed to care for itself and its descendant, and rarely to extends features such as converting other <a> tags into soft navigations
Ring-necked DuckOP
Yeah
That model is great
and also "i think react fumbled explaining RSCs because a lot of people thought that it would be pure html that they render to", i think i disagree. In principle, they do render to string. But Next.js added complexities and abstraction that allows it to output other things
Ring-necked DuckOP
I mainly say that because a lot of people got burned by rsc payloads
This entire thread is people being burned by that misconception that rsc renders to a string (and also doesn't need "hydration")
React could have done a better job mainly saying that it won't solve the issue of double sending data that a lot of people expected from RSC
If you tried the RSC methods yourself, it really does renders RSC into string.
and also
you can't say that english isn't your first language, thats a weak statement lol
Ring-necked DuckOP
English is not my first language
I just did it
See
that does not add any value whatsoever
@alfonsus ardani If you tried the RSC methods yourself, it really does renders RSC into string.
Ring-necked DuckOP
See renderToString also did that
renderToString has been there before RSC
and doesn't do <Suspense>
Ring-necked DuckOP
Yeah?
Let me finish
renderToString also did that
But at the cost of needing hydration data in the browser
I thought rsc and renderToReadableStream didn't need another copy of the data to the browser as well
I guess this is a next.js thing
yes thats what im bothered about!
Ring-necked DuckOP
React doesn't enforce you to have two copies of the data, its a next.js thing to have the rsc payload
its not rsc, its Next.js!
it has nothing to do with your language skill either
Ring-necked DuckOP
Okay, but sometimes its hard to point out where something is coming from
If i rephrase that i think next.js fumbled explaining RSCs because a lot of people thought that it would be pure html that they render to
I don't remember if rsc payloads were brought up when rsc was being introduced
I know its hard to point out where something is coming from, thats why I am telling you all these
Ring-necked DuckOP
I don't like a page's rsc payload being included on the initial page
rsc payloads make sense for navigations
then perhaps next.js isn't suitable for you
afaik there is no way to remove the rsc payloads
the initial payloads
Ring-necked DuckOP
yeah a lot of people in that thread mentioned moving to astro
Ring-necked DuckOP
I should check out astro
Answer
Ring-necked DuckOP
Maybe it's the dumb php mode rendered I'm looking for
do let us know what you think about it! :D
Ring-necked DuckOP
the next team did mention they're willing to explore removing rsc payloads for dead html trees (in the future), so maybe in 2030 it can be solved