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

Did you find this page helpful?