what problem do RSCs actually solve?

title
165 Replies
barry
barryā€¢3y ago
Blazingly Fast can be said in terms of React now šŸ˜‚ barely any js if even any js is being sent to the user
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
so its a replacement for SSR like gSSP
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
barry
barryā€¢3y ago
My thought now is what is react? Mpa or spa since itā€™s now on the server Or do you just use react router on a client component
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
so i were to use vanilla react connected to a separate backend can i use RSC there too? do i have to use a meta framework
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
so now to host a frontend we need a server too?
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
so i have to use next to use RSC right?
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
this stuff is so confusing lol
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
interesting
Brendonovich
Brendonovichā€¢3y ago
RSCs have been talked about for a while, but Next has been the first meta-framework to well support them AFAIK. I'm pretty sure RSCs are just React's implementation of streaming-compatible rendering, compatible with Suspense and concurrency and stuff. How that tech is used is up to the meta-framework, with Next making whether something is generated per-request, ISRd or statically generated up to how you cache your data fetches. All the streaming is taken care of by React, Next takes care of the data + caching
nexxel
nexxelOPā€¢3y ago
thats makes a lot of sense thanks so before RSCs were a thing the client side components used to run on the server to generate the page right?
Brendonovich
Brendonovichā€¢3y ago
Correct
nexxel
nexxelOPā€¢3y ago
and now RSCs help in optimizing that? and make it simpler to SSR
Brendonovich
Brendonovichā€¢3y ago
Previously if you wanted to fetch data on the server you did it in either 1. prerendering, or 2. dynamically. Now that's up to how u cache In my head it makes a lot of sense but I can't put it into words well enough haha
nexxel
nexxelOPā€¢3y ago
yeah i get that
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
so if im not using next, i'd have to roll my own caching system?
Brendonovich
Brendonovichā€¢3y ago
Precisely, react would give you the rendered + streaming html and you'd have to decide yourself whether to cache or dynamically generate. Next takes care of that for you
nexxel
nexxelOPā€¢3y ago
so what does this mean on the hosting side of vanilla react
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
if i build a vite + react project do i get server code too which i would have to host on a server? yeah its a big change
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
so only if i use RSCs, then it would be a requirement
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
Only if you want to dynamically generate html. If you're just prerendering everything then u could render + save html to disk. For the prerendering use case RSCs just provide a nicer way to datafetch, since it's inline in your components rather than in a separate getStaticProps function or whatever
nexxel
nexxelOPā€¢3y ago
ahh so i could use RSCs as a static site generator LUL 0 javascript??
Brendonovich
Brendonovichā€¢3y ago
Well next already lets u do that, but it probs isn't 0 js
nexxel
nexxelOPā€¢3y ago
yeah thats def an improvement
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
its like 90kB js
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
Ah no next prerenders first load but client renders after doesn't it
nexxel
nexxelOPā€¢3y ago
yeah
Brendonovich
Brendonovichā€¢3y ago
In terms of prerendering, RSCs are like Astro components in my head
nexxel
nexxelOPā€¢3y ago
thats another thing, RSCs don't have state, so its not interactive
Brendonovich
Brendonovichā€¢3y ago
U can fetch data asynchronously at the top and then output static html down below
nexxel
nexxelOPā€¢3y ago
yeah i guess thats a fair comparison
Brendonovich
Brendonovichā€¢3y ago
Oh it's actually just like Astro since Astro does SSR too
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
oscar has been typing for so long and says that LUL
Brendonovich
Brendonovichā€¢3y ago
Lmao he been lurking I'm guessing Astro doesn't support streaming or anything tho so L
nexxel
nexxelOPā€¢3y ago
yeah but they're not trying to solve that too
Brendonovich
Brendonovichā€¢3y ago
Oh for sure
barry
barryā€¢3y ago
As of now no
nexxel
nexxelOPā€¢3y ago
and personally, this is a hot take but i think streaming is a gimmick
barry
barryā€¢3y ago
I tried it yesterday was just normal but maybe later
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
oh yeah i think next uses a special version of react
barry
barryā€¢3y ago
Yup
Brendonovich
Brendonovichā€¢3y ago
yeah i'm not sold on it, client fetching really aint that bad
Brendonovich
Brendonovichā€¢3y ago
odd bc they tell u to install latest react
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
maybe i don't understand it well but i don't think there's any need for it yees
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
I have a feeling that their implementation of server components is just that - their implementation. Not actual react server components. If they're using a special version of react then i'm probs wrong tho
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
buggiest major release in software history hehe
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
why bother with streaming when i can use solid and not load the entirety of react for hydration. surely it ain't that bad
nexxel
nexxelOPā€¢3y ago
truee, i think its time to say bye bye react
Brendonovich
Brendonovichā€¢3y ago
man i been saying that solid is omega based
nexxel
nexxelOPā€¢3y ago
if only i could write rust backends <:D_Crying:910659293504745543>
Brendonovich
Brendonovichā€¢3y ago
have u tried prisma + rspc?
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
yo truuuuue
nexxel
nexxelOPā€¢3y ago
not yet but i plan to when i get time
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
šŸ‘€
Brendonovich
Brendonovichā€¢3y ago
when you're just doing db and apis it really doesn't feel like rust the most friction you might feel is async or reference related stuff
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
rspc looks really complicated tho
Brendonovich
Brendonovichā€¢3y ago
lmao true nah dude trust me its super simple
nexxel
nexxelOPā€¢3y ago
lmao half of the stream with mewtru was setting it up LUL
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
yeeeeah we didn't have create-rspc-app
nexxel
nexxelOPā€¢3y ago
is it finished now?
Brendonovich
Brendonovichā€¢3y ago
should be usable soon i hope
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
also did you guys try deploying it serverlessly?
Brendonovich
Brendonovichā€¢3y ago
netlify oscar tried it
nexxel
nexxelOPā€¢3y ago
netlify too op tbh
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
no prisma sadge
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
VerceL
barry
barryā€¢3y ago
Thereā€™s always wasm-pack to turn it into wasm
nexxel
nexxelOPā€¢3y ago
vercel rust support sucks true
Brendonovich
Brendonovichā€¢3y ago
prisma can't be wasmed
barry
barryā€¢3y ago
Sadge
nexxel
nexxelOPā€¢3y ago
why not?
Brendonovich
Brendonovichā€¢3y ago
networking
nexxel
nexxelOPā€¢3y ago
ohh wasm doesn't support that?
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
not well enough bruh
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
barry
barryā€¢3y ago
Letā€™s just remake wasm but better šŸ˜­šŸ˜‚
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
is it an engine or pcr thing tho
nexxel
nexxelOPā€¢3y ago
interesting, but TCP is such a common thing wasm should support that ideally
Brendonovich
Brendonovichā€¢3y ago
It's planned for WASI but just hasn't been done yet
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
data proxy ideally which library?
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
fair well just deploy on lambda and we good workers is edge so i don't really care about that atm
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
edge not even that good
nexxel
nexxelOPā€¢3y ago
tf is wasi
Brendonovich
Brendonovichā€¢3y ago
this message brought to u from perth, australia
nexxel
nexxelOPā€¢3y ago
damn i feel like such a noob šŸ˜­
Brendonovich
Brendonovichā€¢3y ago
basically wasm standard library type beat
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
ohh
Brendonovich
Brendonovichā€¢3y ago
there's a few wasi-compatible runtimes and a lot of them are written in rust lol
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
true haha if pcr can be almost 700 then you're defs early on rspc
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
GitHub
GitHub - Brendonovich/prisma-client-rust: Type-safe database access...
Type-safe database access for Rust. Contribute to Brendonovich/prisma-client-rust development by creating an account on GitHub.
Brendonovich
Brendonovichā€¢3y ago
oh no it's great
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
nexxel
nexxelOPā€¢3y ago
nooo its amazing
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
yeah why build a file browser when u can build next-gen libraries
cje
cjeā€¢3y ago
What does ā€œstreamingā€ mean in the context of rendering a react component? And I also donā€™t completely understand yet what the performance differences will be in a Next 12 vs 13 app if the 12 app was already optimised for SSR/SSG on a per route basis Another thing I donā€™t fully understand is, what happens if server components have children that are client components? And what happens if client components have children that are server components? I would love a video thatā€™s just someone who is asking the right questions talking to Dan or someone else from the React team
Brendonovich
Brendonovichā€¢3y ago
I see it as initially displaying the fallback of a <Suspense>, and then streaming over the final content once the child is done suspending
cje
cjeā€¢3y ago
Oh, so like you send all the server components that are ready, and then when the ones that need data are ready you send those as well
Brendonovich
Brendonovichā€¢3y ago
First you send the loading state over, and then when you're ready send the actual content over
cje
cjeā€¢3y ago
Instead of either making the ones that need data client components, or blocking until the data is done Ok that seems like a huge improvement and maybe worth the increase in complexity
Brendonovich
Brendonovichā€¢3y ago
I think this just waterfalls But the server components are still rendered on the server which is so strange to think
Brendonovich
Brendonovichā€¢3y ago
Found this line which is super interesting
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
Oh wtf that's so wack So client components can't pass props to server components?
cje
cjeā€¢3y ago
I guess it makes sense that client components canā€™t pass props to server components
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
cje
cjeā€¢3y ago
Because those props would have to be sent over http? To render again
Brendonovich
Brendonovichā€¢3y ago
omg it's literally the same thing you're so right
cje
cjeā€¢3y ago
I think this limitation is why they were trying the ā€œserver and client components are the same thingā€ strategy before? It feels like hydration would be a better solution here
Brendonovich
Brendonovichā€¢3y ago
Client components do hydrate
Brendonovich
Brendonovichā€¢3y ago
cje
cjeā€¢3y ago
Start rendering it on the server, when props change just render on the client I mean for client components passing props that might change to server components
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
cje
cjeā€¢3y ago
I foresee us staying in /pages for a while tbh And figuring it out when the dust settles
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
Yeah this shit is pretty complex haha
cje
cjeā€¢3y ago
Maybe the biggest question for me is
Brendonovich
Brendonovichā€¢3y ago
And even then the search bar pre-renders and hydrates
cje
cjeā€¢3y ago
If a bunch of nerds who think about this stuff in their free time struggle to understand, wtf will a worker bee react dev do?
Brendonovich
Brendonovichā€¢3y ago
I think that while we're still in the mindset of getStaticProps, getServerSideProps and the like we're all going to find it confusing But this new streaming & suspense mindset is a whole new paradigm that's defs gonna take time
barry
barryā€¢3y ago
lol šŸ˜‚
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
Kinda like when hooks were introduced
cje
cjeā€¢3y ago
Hmm true
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovichā€¢3y ago
People still don't know how to use useEffect
cje
cjeā€¢3y ago
Hooks were clearly the right decision But there was a lot of pushback at the start
Brendonovich
Brendonovichā€¢3y ago
I've been using suspense for years so I think I've got a decent grasp of things, I just haven't used Next 13 yet
Brendonovich
Brendonovichā€¢3y ago
Also lmao no server class components
Unknown User
Unknown Userā€¢3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server