Content pfp
Content
@
0 reply
0 recast
2 reactions

Brenner pfp
Brenner
@brenner.eth
Ok who wants to help me understand nextjs app router? And ‘use client’ vs ‘server-only’? I’m not used to not being able to have any “useState()” functions wherever I want??
10 replies
9 recasts
90 reactions

dylan pfp
dylan
@dylsteck.eth
going to try my best to explain this in one cast(as someone who's read about RSCs but hasn't used them much lol) client-side code needs to be marked as 'use client' -- client code can run in server code files, but not the other way around server-only code makes the function itself async, so you can mutate data & return UI with that data eg. your client-side code could be static info like a navbar and then instead of blocking while waiting for your API request, the server can load the data and ui together
1 reply
0 recast
4 reactions

dylan pfp
dylan
@dylsteck.eth
this is a great read on server components https://www.joshwcomeau.com/react/server-components/
0 reply
0 recast
1 reaction