React + Servers = Confusion

Ғылым және технология

Server Actions seem to be confusing people a lot. Wanted to jump on the opportunity and showcase how they are just as composable as we expect from React and Next, while also showcasing how to use it alongside tools like tRPC
GITHUB REPO: github.com/t3dotgg/server-act...
Check out my Twitch, Twitter, Discord more at t3.gg
S/O Ph4se0n3 for the awesome edit 🙏

Пікірлер: 162

  • @mementomori8856
    @mementomori88566 ай бұрын

    I don't know how anything works anymore in these frameworks and I HATE it. I hate just using it because the documentation says so. Not knowing what goes on behind the scene annoys me. I understand Server Components and Server Actions now thanks to you clearing things up for us, I hope they don't bring crazy changes in like a week or something, we need stability.

  • @dstick14

    @dstick14

    6 ай бұрын

    Yes! You spoke to my heart! They just keep on adding more magic thinking that we'll just keep gobbling it all up. Everything that's trending now will be deprecated in a few months and there will be a new NextJS version to "fix" everything. Also I question the ethics of Vercel where I see them making react more of a mess and server oriented increasingly to their benefit and they've completely overtaken the react project as of now

  • @SXsoft99

    @SXsoft99

    6 ай бұрын

    move to something more stable

  • @qwerty-or1yg

    @qwerty-or1yg

    6 ай бұрын

    Exactly this. I used to love next.js. I do work with angular at work and with nextjs on my personal project. And at this point I can safely say that I really starting to love angular and hate nextjs. Like angular seems way simpler to me at this point, less of that magic, routing is straight forward, etc. I don’t know, I’m just venting at this point.

  • @crab-cake

    @crab-cake

    6 ай бұрын

    @@qwerty-or1yg solidstart looks promising but it's still in beta. if you like rust there's leptos which is essentially a clone of solid/solidstart in wasm. i think leptos is actually more intuitive and less verbose in a lot of ways, especially for server functions, because it's just a macro. server/client code is colocated so you don't have to deal with all of these client/server files everywhere. unfortunately javascript as a language is limited which is why 'use server' etc is even a thing.

  • @croakgrogan

    @croakgrogan

    6 ай бұрын

    Couldn’t agree more.

  • @skapator
    @skapator6 ай бұрын

    Wow, this looks super production ready and stable and battle tested. And DX is super. Dopamine hit for my brain. What can go wrong? Waterfall = bad, magical stuff = good. Solves so many issues that we did not have. Immaculate doesn't even begin to describe this.

  • @OmegaLok

    @OmegaLok

    6 ай бұрын

    Many sarcasm, strong wow

  • @dnserror89

    @dnserror89

    6 ай бұрын

    Some will think you're being serious LOL

  • @skapator

    @skapator

    6 ай бұрын

    @@dnserror89 I know, sarcasm is a good separation tactic.

  • @xen2297
    @xen22976 ай бұрын

    What a total mess

  • @incarnateTheGreat

    @incarnateTheGreat

    6 ай бұрын

    It honestly feels like a new way of thinking and it doesn't feel natural at all. I don't wanna say "we have to get used to it", because I'm sure the Next team will have to come up with a better way of updating your content via server actions.

  • @dstick14

    @dstick14

    6 ай бұрын

    ​@@incarnateTheGreat it's pure sorcery. There answer to do anything now is just to modify the code at compile time and abuse the Javascript syntax to its breaking point. The memes just keep writing themselves, as if there weren't enough gotchas is JS and now I shiver whenever Theo drops a video 😂

  • @incarnateTheGreat

    @incarnateTheGreat

    6 ай бұрын

    @@dstick14 I'm hopeful. RSC or Server Actions will find a way. I was coming up with a solution like what Theo did (the vanilla one) and was pretty much on the same path.

  • @oleglustenko

    @oleglustenko

    6 ай бұрын

    We wrote applications this way with redux for years. Where have you been?

  • @bbbb12281
    @bbbb122816 ай бұрын

    This is just pure madness at this point. This all feels very similar to all the useEffect issues. Instead of cleaning up those APIs, they just build on top of them and try to further abstract their own mess. Also feel like Theo is just lobbying for Vercel at this point without questioning any of this. I think this is a good time to switch back to something like Rails/Laravel or maybe SolidStart/SvelteKit if you want to stay in JS world.

  • @saberxjm

    @saberxjm

    6 ай бұрын

    No sir, I believe you meant the other way around as in "Vercel lobbied Theo". And yes, this type of shit is life-ruining to not a small number of developers who entered this field in good faith, as they will never find solace in the "skill" or "craft" in which they sacrificed all aspects of social life and connections(things that matter and have real life consequences) to attain. Welcome to React 2023, where the theme for this year and perhaps many more to come is: "Let's build castles on sand."

  • @dixztube
    @dixztube6 ай бұрын

    Feels like a politician telling ya how good react is where react is top lobby lol

  • @nate_codes
    @nate_codes6 ай бұрын

    0:29 - That was MY source code that fundamentally misunderstands server actions!! I've never been so happy to nerd snipe someone and not only get personalized help but a YT video out of it! Incredible resource Theo, thank you so much for putting together this repo as it has already helped me grok server actions much better!

  • @RolandAyala
    @RolandAyala6 ай бұрын

    wow, talk about over-engineered. watching this validates my decision to switch from next to remix.

  • @MegaKakaruto
    @MegaKakaruto6 ай бұрын

    At this point I'll use laravel and inertiajs for my sanity

  • @IvanRandomDude

    @IvanRandomDude

    6 ай бұрын

    Laravel ecosystem is so good.

  • @jasonmarmon5480
    @jasonmarmon54806 ай бұрын

    What if we just dont

  • @turculaurentiu91

    @turculaurentiu91

    6 ай бұрын

    I think this is the best approach

  • @UwU-dx5hu

    @UwU-dx5hu

    3 ай бұрын

    I think I like that

  • @dstick14
    @dstick146 ай бұрын

    If nothing else this should be a clear signal for an average JS developer to jump ship and learn something better because this is bending what Javascript is supposed to be to a point that it can be just a new language. And remember, *whatever that is trending right now will be a deprecated practice a few months from now* especially with how fast this thing previously called react is mutating

  • @nickwoodward819

    @nickwoodward819

    6 ай бұрын

    @@ivan.jeremic hmmm, i don't think it's completely unreasonable to dislike that they're fixing an issue their own approach created, especially when that approach required a significant shift *away* from web/html fundadmentals in the first place.

  • @dstick14

    @dstick14

    6 ай бұрын

    @@ivan.jeremic buddy in simple words I am saying is next js is too much magic for me personally. I don't want to keep learning everything from scratch every third month when they decide to add some more revolutionary ideas that is supposed to improve "DX". Web development is supposed to be simple you create a frontend and a backend and just make them talk using REST, GraphQL or RPC and that's it. Anything more complicated than that is mental illness and nothing but premature optimizations

  • @mr.komp1004

    @mr.komp1004

    6 ай бұрын

    @@dstick14 So basically you dont care about UX? RSC doesnt solve DX problem, and all those updates not about DX. Prev, you could generate some code on BackEnd then you would have your React code send to FrontEnd, where it is hudrated from Json type to VDom with html and you would have so much more code send and used for simple stuff. With RSC you also send from BackEnd your code, but now you dont send your "React code" useState, useEffect and then hydrate it on client side. You send already hydrated Json, that just embedded to VDom

  • @JokcyLou
    @JokcyLou6 ай бұрын

    You should definitely talk about error handling in server action, especially server action on RSC. It seems we have to use the fallback error component for it, and it's hard to make a good UX like client components do.

  • @lpmacau

    @lpmacau

    6 ай бұрын

    Maybe not totally related, but you can do that with Zod and next-safe-action. I am currently using it in production. You get a {data, validationError, serverError} object from the next-safe-action and then you can do anything you need with that. In my case I am running zod on client and server side. If there is a validation error on client, it doesn't post the action ofc. If there is a validation error from the server side (shouldn't happen, but for some reason if it does) or a server error (e.g. getSomething(ID) and ID is not found) I show a toast to the user

  • @TheEdoRan

    @TheEdoRan

    6 ай бұрын

    @@lpmacau Wow, super cool that my lib is already used in production!

  • @lpmacau

    @lpmacau

    6 ай бұрын

    @@TheEdoRan and works like a charm 😉

  • @shadowfaxenator

    @shadowfaxenator

    6 ай бұрын

    They just can't show you error handling, cause if they do they'd break progressive enhancement and "lego pattern with react". So they show only marketing videos to promote vercel

  • @JokcyLou

    @JokcyLou

    6 ай бұрын

    @@lpmacau I see this, great lib. I just take a look at the example, it is a client component example, server action for client component is much more easier because action just like a normal api call. So as I saied, for RSC, the problem become much more complicated

  • @nro337
    @nro3376 ай бұрын

    amazingly helpful demo! this needs to be in the next docs

  • @Exilum
    @Exilum6 ай бұрын

    Server actions in a different file is what I did with the experimental flag and what I continued doing after upgrading my project. I really don't like mixing my client & server code. Something really cool with that is that you can still share definitions between client & server while at the same time maintening a good old separation of concern.

  • @nathancng
    @nathancng6 ай бұрын

    Super helpful video - thanks Theo! Sometimes, because of all the ways our minds have changed with TRPC, using createCaller still feels a little wrong, but this video helps justify it and the fact that I need to spend time doing the mental model shift.

  • @PyrexCelso
    @PyrexCelso6 ай бұрын

    I’ve been using the pattern for calling server actions from client components with startTransition and for me it’s the best one. Yes, sometimes I have to create the client components just for this but a lot of times my forms will include logic that calls for client components like client side validation, immediate feedback, etc.

  • @orderandchaos_at_work
    @orderandchaos_at_work6 ай бұрын

    All these new updates have highlighted all the benefits of using something else.

  • @TheEdoRan
    @TheEdoRan6 ай бұрын

    Thank you Theo for mentioning next-safe-action!

  • @gotxe
    @gotxe6 ай бұрын

    No 'use server' - no confusion.

  • @jikaikas
    @jikaikas6 ай бұрын

    fine ill just use htmx

  • @IvanRandomDude
    @IvanRandomDude6 ай бұрын

    I would like to see how we can write tests for this.

  • @4ndrs_dev
    @4ndrs_dev6 ай бұрын

    awesome, thanks we started using server actions just this week at my workplace

  • @JLarky
    @JLarky6 ай бұрын

    Everyone was so gloom and doom about tRPC dying once RSC drops :) and turns out that tRPC is the perfect layer to call from your server actions even if you don't use client components from tRPC

  • @ghostlexly
    @ghostlexly6 ай бұрын

    Well, server actions looks good only if you plan to use your api on your nextjs project and nowhere else. The day another team will request you an access to an endpoint of your company from their tools, you will have to write a new backend for them lol

  • @ghostlexly

    @ghostlexly

    6 ай бұрын

    Same thing if you plan to code a mobile app one day, you will have to write a new backend ..

  • @carlosricardoziegler2650
    @carlosricardoziegler26506 ай бұрын

    Nice options, I want to check more deep about that. I liked it, thanks :)

  • @jacobhuiet4217
    @jacobhuiet42174 ай бұрын

    Do the performance benefits outweigh the added complexity? Maybe. I’m gonna fiddle with this in a side project to see if it’s worth using, but for production apps I still feel like I’m leaning towards client side for most complex use cases. I’ll probably throw in server components and actions for small simple forms or view only sections of the app

  • @bules12
    @bules126 ай бұрын

    I have been using react for two years I used redux, redux-toolkit, react query etc But I didn’t used trpc because you could have to consume a backend different than NodeJs with typescript and it’s enough to use react query Also I found “use-server” very confusing and not completely necessary, because we have easier to understand alternatives to do this. The main advantage of using use-server is saving some lines of code and declaring types. But do you think it is worth it to confuse an entire community for this purpose? When you code not only T3 will read your code and will understand it, but other people will have to do it. And trust me, is better to put things clear to other people.

  • @philheathslegalteam

    @philheathslegalteam

    6 ай бұрын

    I hope you are writing an OpenAPI Specification for your apis...

  • @bules12

    @bules12

    6 ай бұрын

    @@philheathslegalteam Im mainly front end developer, my coworkers take care about implementing swagger and openAPI specification But I would do if needed :) Although I wouldn’t use python or php for my side project backend, Trpc and T3 stack is completely perfect when you aren’t attached to a company

  • @philheathslegalteam

    @philheathslegalteam

    6 ай бұрын

    @@bules12 good stuff then its not problematic at all. OpenAPI typescript can make react query and SWR act the same way as tRPC with e2e typesafety. Or if you’re just using raw react query you at least have the types clearly defined by the API

  • @cristo_sal
    @cristo_sal3 ай бұрын

    This makes php5 look good

  • @tom.watkins
    @tom.watkins6 ай бұрын

    As I have a separate backend I won't be moving off tRPC anytime soon but even if I didn't, I have to say I still much prefer tRPC over the way they showed server actions directly in components, I like the client server separation. Throw in middleware, context and the other useful features that tRPC provides and I think it clearly offers a better DX than server actions do. Big fan of server components but server actions, not so much

  • @Marviuz
    @Marviuz6 ай бұрын

    Really helpful video and I really like the last one! I'm new to app router and I'm currently doing `Object.fromEntries(formData.entries())` for my server actions then parsing it with a zod schema of my expected shape. Any drawbacks to doing this?

  • @aj35lightning
    @aj35lightning6 ай бұрын

    Right off the bat it feels so unintuitive to know that you had to structure things inside of a form. so many things implicit or abstracted in a way that feels easy to do things wrong

  • @penname4764
    @penname47646 ай бұрын

    I almost stormed out of the room with frustration watching your video but glad I stuck it out to the end. That last pattern is definitely the way forward. The other patterns are just DX when writing code around forms but ultimately terrible for reading/maintaining code

  • @codeChuck
    @codeChuck4 ай бұрын

    After installing create-t3-app, and watching your guide about T3 stack, this video is right what I needed! You have shown how to use createCaller, server actions standalone, and with tRPC, which is very convenient! Also, please explain, which pattern works best for you, which is you default approach between these 4 now?

  • @griffadev
    @griffadev6 ай бұрын

    Interested to see how you'd get auth middleware with something like clerk working with trpc in server actions

  • @timbo-slice
    @timbo-slice6 ай бұрын

    I am currently using the trpc client approach and I am having problems with refreshing page content. Could you do something on Next caching? I feel like there is no good way to invalidate a specific page other than the one you are currently on with the trpc client approach. For example imagine a page /editContent where an admin can edit a database entry which is displayed at /content. How would I inform the client, that its cache for /content is invalid? I would need to invalidate the cache for every client currently storing the old content of /content.

  • @aghileslounis
    @aghileslounis6 ай бұрын

    Thanks Theo, great content as always! A video on Phoenix/Elixir Theo :)

  • @TheJubeiam
    @TheJubeiam6 ай бұрын

    Thats fucking insane complicated, thank You for explaining.

  • @Fry981
    @Fry9816 ай бұрын

    Just a few notes base on my recent dive into server actions. All data going into your server action doesn't have to be included in the form itself. You can pass in additional args through bind (e.g. . Also, and this is a bit of an ugly hack, you can force React to clear your form fields on revalidation by changing their keys. I do it by setting their key to performance.now() (e.g. ). No need to create a client component just for that. Additionally, I suggest you use redirect("/path") instead of revalidatePath("/path") at the end of your server actions because, when running with JS disabled, refreshing the page after submitting a form will cause it to submit again (old school webdev problems frfr).

  • @capability-snob
    @capability-snob6 ай бұрын

    API security really isn't an irrelevant detail. Are those hidden fields in the closure replayable? Do they have perfect forward secrecy? Are there session-stealing style vulnerabilities here? Making the mechanism explicit makes it clear what trade-offs are being made. If you care about being explicit with types, you definitely want to be explicit about the security properties of your system.

  • @incarnateTheGreat

    @incarnateTheGreat

    6 ай бұрын

    I think those encrypted input fields can't be decrypted, or else Next would have a problem on their hands.

  • @stephenisienyi7726
    @stephenisienyi77266 ай бұрын

    For production use, avoid this quirks mode concoction and its older cousins, NextJS and server components, like the plague. With all due respect.

  • @bielgaucho_real
    @bielgaucho_real6 ай бұрын

    Is that just next js or is that react implementation? Because it would be very nice to have this "action" endpoint that has many action types automatically created easily outside of next. By biggest fear is react just becoming next.

  • @pencilcheck
    @pencilcheck6 ай бұрын

    I just use telefunc and no issues at all, this also comes at a benfits of getting rid of nextjs, trpc, tanstack query, etc that slow down everthing. Basically I use one that remove 3-4 other dependencies.

  • @grant_vine
    @grant_vine6 ай бұрын

    Omg that side effect confused the crap out of me when suddenly I didn’t need formData in that separate file and everywhere the docs keep talking about forms…. I thought I had done something wrong lol

  • @kr30000
    @kr300006 ай бұрын

    Naah, I'm not going to use this. Forget it

  • @nickwoodward819
    @nickwoodward8196 ай бұрын

    I'm new to nextjs so forgive me if this is a stupid question - but why does revalidatePath show the new content? docs seem to say it clears the cache, so it's not actually sending the new data to the client until they refresh, right?

  • @nickwoodward819

    @nickwoodward819

    6 ай бұрын

    Also, is it a reasonable mental model to think of it as the form sending a reference to the function to be called, that would have traditionally been called by a controller in express? So instead of hitting '/somepath' and having `Controller.doSomething()` run, the form just has the action `doSomething()`? Anyway, love the videos 👍 *edit: oh, it's a closure not a reference?

  • @bluesbr09

    @bluesbr09

    6 ай бұрын

    @@nickwoodward819 And regarding your other question: When you write a server action, an endpoint is created on the server once you start it. When you call the action in your code, at runtime that endpoint is called. The form, when a user interacts with it on the client, has no access to the action you wrote because it lives on the server. It instead calls the endpoint associated with your action. You mentioned closures in your edit: You are allowed to use closures in your server actions when writing them inside a component. Since the outside is React code, and it might live on the client, they needed a way to save that closure data. So they added a few encrypted, hidden inputs that are sent alongside the form data to the server action endpoint. This is the reason that if you define server actions in a component, you can only do that in forms (via the "action" prop) or buttons (via the "formAction" prop) inside a form. This is my understanding up to now, at least. Hope that helps!

  • @bluesbr09

    @bluesbr09

    6 ай бұрын

    First reply got removed, presumably due to me posting links. Let's try again: It's definitely not a stupid question. You're right, the docs don't explicitly state this in the revalidatePath or revalidateTags docs, which is where you expect them to state that. But other parts of the docs do in fact state it: "Further, the browser does not need to refresh on form submission. In a single network roundtrip, Next.js can return both the updated UI and the refreshed data." See the nextjs documentation at /docs/app/building-your-application/data-fetching/forms-and-mutations#revalidating-cached-data And: "There are two ways you can invalidate the Full Route Cache: Revalidating Data: Revalidating the Data Cache, will in turn invalidate the Router Cache by re-rendering components on the server and caching the new render output." See the nextjs documentation at /docs/app/building-your-application/caching#invalidation

  • @gustavoh5143
    @gustavoh51436 ай бұрын

    when react used to be just a front ent library, everything was easier

  • @kkebo

    @kkebo

    6 ай бұрын

    Skill issue

  • @ahmedivy

    @ahmedivy

    6 ай бұрын

    New thing is more simple

  • @Karan-gh9ki

    @Karan-gh9ki

    6 ай бұрын

    @@kkebo no its dogshit now

  • @raphauy
    @raphauy6 ай бұрын

    Very helpfull, thank you!!!

  • @emanuellarini
    @emanuellarini6 ай бұрын

    Very frustrating to find components without following the entire tree since they were moved up/down because of use client vs use server

  • @georgespanos4680
    @georgespanos46806 ай бұрын

    This is the worlds greatest thumbnail.

  • @RationalDissonances
    @RationalDissonances6 ай бұрын

    what about import server actions into a server component to act like a post route?

  • @fischi9129
    @fischi91296 ай бұрын

    I'm still not clear on how SSR is better than Hybrid (SSR first, Hydrate after after), like, what's the downside of that approach?

  • @heaps.

    @heaps.

    6 ай бұрын

    The argument is that it's more efficient to split rendering between the client and server, instead of rendering everything on both. I'd argue that for the vast majority of projects, it isn't worth the effort.

  • @fischi9129

    @fischi9129

    6 ай бұрын

    @@heaps. I generally take the SSR-> hydrate into SPA approach since it sounds the lost sensible to me tbh. It keeos server load somewhat low (nice for me since I gotta pay that), devices are easily performant enaugh to hydrate quickly and make everything very fast and snappy... so the ssr-> hydrate spa sounds the best of all worlds with virtually no downsides to me... still (ofc not everything needs it and probably easier to implement solution would be suggested)

  • @heaps.

    @heaps.

    6 ай бұрын

    @@fischi9129 Agree on all points 👍

  • @nigeldasilvalima4568
    @nigeldasilvalima45686 ай бұрын

    Ok, the subscribe thing got me there hahahah

  • @chad_giga6934
    @chad_giga69346 ай бұрын

    I totally appreciate the work you do to make these concepts clearer for all, but The mess called js frameworks we're pushing is just absurd. This is discouraging beginners to get into web dev. Because of the millions of things we are pushing to be in this space, the moment you go back to edit a nextjs app you build last year November, you start seeing crazy errors and package updates with api changes and no other dev can make changes.

  • @tommycallsuback
    @tommycallsubackАй бұрын

    how were u able to use trpc api in client component while having it "server-only"?

  • @Wundero
    @Wundero6 ай бұрын

    You can actually use async at the top level for the API createCaller logic, just await the creation of the context prior to passing it into the function and it seems to work just fine, since NextJS supports top level await.

  • @bluesbr09

    @bluesbr09

    6 ай бұрын

    Do you mean adding something like: const user = await currentUser(); // e.g. Clerk's currentUser function export const api = appRouter.createCaller({ db: db, headers: headers(), user: user, }); ? Are you 100% certain that all of this code is run again and again per request, and not persisted across requests somehow (leading to different users using each other's sessions)? I have bad experiences with setting unscoped variables like this in Next, since it used to persist across requests in the pages router.

  • @_techbk
    @_techbk6 ай бұрын

    Was hoping to see a link to that taint video in the description 😪

  • @freyfrenzy
    @freyfrenzy10 күн бұрын

    “Error: Viewer is not subscribed” 😹😹

  • @kingsleykelechionwuchekwa7508
    @kingsleykelechionwuchekwa75086 ай бұрын

    next-safe-actions package is the goat

  • @TheEdoRan

    @TheEdoRan

    6 ай бұрын

    Thank you!

  • @pe....
    @pe....6 ай бұрын

    I've seen that title changes...

  • @dnserror89
    @dnserror896 ай бұрын

    11:30 lmao ok u got me good

  • @NicolasVegaTerrazas
    @NicolasVegaTerrazas6 ай бұрын

    Annoying that the context doesnt work with the callers, how do we protect mutations with trpc in the hybrid pattern then? If this is not possible, I'd call it more an anti-pattern.

  • @AndersGustafsson87

    @AndersGustafsson87

    6 ай бұрын

    It does. He just passed an empty object as context in this video

  • @user-gm2rv8tv4e
    @user-gm2rv8tv4e6 ай бұрын

    11:30 that was funny haha

  • @froxx93
    @froxx936 ай бұрын

    I am playing around with app router and all of its things for a while now, and it seems pretty magical. In a positive and a negative way. If you understand how everything is intended to be used, you can really fly doing things. But things are getting so implicit and are losing the self-explaining part that e.g. page router has, that it's hard to keep up to date, and master the thing. I'm not even starting on how it must be like if you are working in a bigger team with engineers that are not as passionate as most of us are.

  • @aizensoskue3880
    @aizensoskue38806 ай бұрын

    sveltekit has server actions with much more simpler approach no headaches

  • @essamal-mansouri2689
    @essamal-mansouri26896 ай бұрын

    I feel like you jumped through 15 hoops just to get this to kinda work. How is this "good DX"?????

  • @jhjhj2172
    @jhjhj21726 ай бұрын

  • @antsii
    @antsii6 ай бұрын

    this is content

  • @heaps.
    @heaps.6 ай бұрын

    React has jumped the shark.

  • @thisisjohnny
    @thisisjohnny6 ай бұрын

    So… it only took us twenty years to recreate Apache Struts?

  • @bielgaucho_real
    @bielgaucho_real6 ай бұрын

    So trpc will just become a simple api for using zod on inputs and outputs. Nobody with react will ever use trpc as a client anymore, its just easier to call the server trpc method itself and a export this pretty async function using server actions.

  • @darkerisbetter8699
    @darkerisbetter86996 ай бұрын

    I strongly dislike everything I've seen about server actions. They don't solve a problem that I have. I'd love to see an example where going all-in on server actions makes sense, especially for teams with non-trivial codebases.

  • @codeChuck
    @codeChuck4 ай бұрын

    Great error trick to get more subs!!! :)

  • @FarukAFeres
    @FarukAFeres6 ай бұрын

    The first one smells like webforms...

  • @AngelEduardoLopezZambrano
    @AngelEduardoLopezZambrano6 ай бұрын

    I don't see the difference in the 4th action, you are basically using the "use-server" function in a different file. I've been using this for months as well. I don't want my server functions in the same file as the component

  • @viky2002
    @viky20022 ай бұрын

    it's coupled AF

  • @SangharshSeth
    @SangharshSeth6 ай бұрын

    Arghh wtf is even going on in react land. I am lost.

  • @TightyWhities94
    @TightyWhities946 ай бұрын

    This shit was the last straw before I quit Javascript. I converted from fullstack JS engineer to non-JS backend engineer and I'm never touching JS again unless I'm the one making the decisions. I'm getting too old to deal with the hyperactive JS monkeys "innovating" just because.

  • @Cohors1316
    @Cohors13166 ай бұрын

    So react server is a less efficient version of what qwik is doing. I’m just gonna continue to avoid react like it’s the black plague.

  • @luispozo2380
    @luispozo23806 ай бұрын

    Are you getting paid? Because at this point - There's no point to make.

  • @tabletuser123

    @tabletuser123

    2 ай бұрын

    He's sponsored by vercel if you don't already know

  • @yacineidir7616
    @yacineidir76163 күн бұрын

    Too much magic. Pls link me anything that makes sense of this. Is it making http calls under the hood? Webhooks ? Sockets?? So server actions is generating hidden api endpoints??

  • @Kaczucha888
    @Kaczucha8886 ай бұрын

    I would call the server action directive "use another footgun". React is certainly pushing the community forward, but it relies on weak abstraction foundations like VDOM and useEffect and instead of working on those they keep on adding more stuff that is fragile and hard to make good. Looks like it is time to switch to Solid.js, it can also have server actions in future, after learning on react mistakes

  • @yojou3695
    @yojou36956 ай бұрын

    that use server string literal still is the most disgusting thing i have seen

  • @BarakaAndrew
    @BarakaAndrew6 ай бұрын

    😡 all this is just frustrating. I won’t follow this. My structure is one rest api server (json) handles both web and mobile, web most logic is just view, fetch data from api server in json, if I need ssr I just pull data from the frontend server to api server for initial render, anyone can work on the api server without talking to frontend ever, frontend also never touches the db, everything pass via api server. Easy, simple, no bs

  • @martinquintana2458

    @martinquintana2458

    6 ай бұрын

    I am about to start working in a similar project with one restaurant api server. I’m probably going to use RSC to do the requests on the server for more performance in the initial rendering. But probably I’d skip server actions as they don’t make much sense in this scenario

  • @vishalsangole836
    @vishalsangole8366 ай бұрын

    please please explain concurrent react!!!!!!!!!!!!!

  • @hazeion
    @hazeion6 ай бұрын

    Ehh.. server actions = Server-Side useEffect. It's not intuitive. Still hard to wrap your head around. This video demonstrates more Theo's masterful understanding of React and his ability to reason about it than it does to demonstrate easy server action implementation. I appreciate the video because it truly helps. But I'm gonna call Server actions an L for now.

  • @UwU-dx5hu
    @UwU-dx5hu3 ай бұрын

    I hate drizzle and prisma...raw sql is always more powerful😢

  • @rickmedina4082
    @rickmedina40826 ай бұрын

    all I see is an inferior meteor.js

  • @andrewforrester6713
    @andrewforrester67136 ай бұрын

    Enjoyed the video, as usual. Not suuuuper into the aggressive "look at all this value I'm giving you, subscribe or you suck" bit. I'm subscribed, just find it very off-putting

  • @MonstraG55
    @MonstraG556 ай бұрын

    Maybe I wasn't paying too much attention, but before watching this video I did not know what server actions are, and I still do not understand anything about them. Your simplest vanilla example still somehow imports from `db`, `trpc`, `next/cache`, and `drizzle` and I don't know what any of these are! Don't know about `db` because it's part of the repo you're showing so I did not see it before, the others - never heard of them. How could that be a simple example? And then it becomes worse. React-query, Data Access Layer, `caller` pattern, "use server", "use-server" but it's in a file, not in a function...

  • @user-qq7yc1qp8z
    @user-qq7yc1qp8z6 ай бұрын

    What's confusing about them, are people just dumb? It's just a code on the server you call, like you would write an endpoint and make a post request, but with this you don't need all the boilerplate, and can just use server actions

  • @ys1197

    @ys1197

    6 ай бұрын

    Exactly

  • @ssg6499
    @ssg64996 ай бұрын

    Switching to Astro, Nexting next. Don't like where it's going, Very bad design choices.

  • @sinkie420
    @sinkie4206 ай бұрын

    I dont get why would anyone need trpc anymore? Even zod on backend? Server actions once exported from a file marked "use server" are fully typesafe and usable on both client and server components, its truly write once and use everywhere, couldn't be more simple. I integrated them with tanstack react query on client components and used it's methods for optimistic updates/revalidating data, passing the action as the fetch function. Am I missing something?

  • @zainul1996
    @zainul19966 ай бұрын

    First

  • @TheBuddilla

    @TheBuddilla

    6 ай бұрын

    != first

  • @semyaza555

    @semyaza555

    6 ай бұрын

    @@TheBuddillaconst third = “i’m”

  • @ayushdhokriya6488

    @ayushdhokriya6488

    6 ай бұрын

    Typecheck it

  • @MrRaitiz
    @MrRaitiz6 ай бұрын

    Please, just leave react for COMPLEX apps for client side...

  • @aka.theos.
    @aka.theos.6 ай бұрын

    Server actions are just washed down HTMX. Prove me wrong :p.

  • @fnfal113
    @fnfal1136 ай бұрын

    Use laravel, life gets simple.

  • @BanAaron
    @BanAaron6 ай бұрын

    God, JavaScript is such a failure. Watching video made my soul weep. What ever happened to KISS? I'll be sticking to using Vue, Svelte, and React with Go or Python in the back end

  • @berkerdemirer7982
    @berkerdemirer79826 ай бұрын

    wtf was that? at this point i'd rather use php

  • @croakgrogan
    @croakgrogan6 ай бұрын

    This isn’t React. This is Next nonsense.

  • @Woeden
    @Woeden6 ай бұрын

    Javascript is a mess, we need a replacement for the web.

  • @saberxjm

    @saberxjm

    6 ай бұрын

    This is not javascript's shortcomings, it is React and the people behind it promoting the practice of building castles on sand.

  • @memento-mori-2097
    @memento-mori-20976 ай бұрын

    stop trying to make RSC happen it's not gonna happen

  • @gabrielbianchi2246

    @gabrielbianchi2246

    6 ай бұрын

    RSC patterns are infinitely better than what we had before. Server ACTIONS are a whole different category of things. Important to have distinction