Тёмный

Server Actions: NextJS 13.4's Best New Feature 

Jack Herrington
Подписаться 184 тыс.
Просмотров 61 тыс.
50% 1

Опубликовано:

 

10 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 167   
@claus4tw
@claus4tw Год назад
I recommend for thee `server actions with queries`-part that you: 1. declare your server action in a separate file and mark the file as 'use server' in the top 2. export the server function 3. import the server function IN THE CLIENT COMPONENT 4. profit. There is no need to pass down the server action as a prop to the client comp, it can be directly imported as well.. A server action can even pass down a react component as well.
@jherr
@jherr Год назад
Great tip!
@_ingadi
@_ingadi Год назад
@@jherr Do server actions trigger the middleware in NextJS?
@rahul4tech
@rahul4tech 9 месяцев назад
@claus4tw yes that is what i am trying to do but i found something which i dont understand i have my problem in the comment i am pasting here also if you can guide me little this was my question i am following same thing with little different approach and i would like to know why it behaves like this so i also have a little todo project trying to understand server action mostly "use server" and "use client" here is my setup i have 4 files which are as follows: submit.ts => server action function Form.tsx => client component Tables.tsx => client component => to show all todos todo.ts => just a variable to store data todo.ts => code interface todosContract { todo: string; date: string; } const todos: todosContract[] = []; export default todos; and main page.tsx => server component what i have found is when using client component in form and table i cant directly import todo.ts to map data when imported submit.ts and applying to form action , i see on server seide data is added todos but its not reflecting in table, i mean on client side data is always empty i found when i send submit.ts as props to Form.tsx from main page.tsx for action this resolves the problem i can see the data in table then, i am not sure if this is right approach or not i hope you understand what i am trying to say. i would really like some insight on this UPDATE does this mean when i am doing "use client"; import todos from '@/app/todo/todos'; does that mean this todos when initialised as this was empty initially and i am using "use client" that means its a different instance now on client side then of server side hence when server action push data to todos on server side, client never get updated that as it was treated as different variable for client side. just a thought
@Pptruenoz
@Pptruenoz Год назад
I always like your videos, explaining hard concepts through simple words and practical examples
@inasuma8180
@inasuma8180 Год назад
i'm not going to lie. it's kind of magical to see server code running in response to user/client interaction. this is the type of thing that becomes hard to wrap your head around and i hope the next team can disspell any confusion around it with good docs and consistent patterns.
@plart2006
@plart2006 Год назад
so am I, cause now I can't imagine how to use these ui framework providers (which automatically turn your app into client side app), axios apis and so on in prod
@liketocode
@liketocode Год назад
Yes, I am struggling to do 'useState' local error handling on form inputs before the server action is triggered. In @hamedbahram's video ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-sdKFEo6978U.html, he defines an async/await client function in his form client component - which awaits response of the server action function, for me React produces a runtime error: 'async/await not supported in client component'?? @jackherrington Thanks!
@KevinPeters
@KevinPeters Год назад
I went all on in server actions when they came out. I rewrote large parts of an app I am working on which originally used the t3 stack and trpc. Now I use drizzle-orm, server actions, zod, next-auth, and react-query and so I have end-to-end typesafety including validation, authorization and no codegen in between. Things are still a little rough around the edges (next-auth needs a a workaround to validate the session because getServerSession doesn't work yet) but it's certainly a lot of fun!
@joseantoniotorres5
@joseantoniotorres5 Год назад
how do you handle mutations? I am using SWR but I am having hard time dealing with form mutations
@henriquemoreira1879
@henriquemoreira1879 Год назад
I'ts great to hear that. I'm currently working in a project, we are beginning to add some type of authentication, I tried to implement Next-Auth because I was familiar with it in the past versions of NextJs, but right now I'm having so much problems to implement it. Can you please help me ? Like, how do you made it validate the session for example ? If you have some explanations or articles, I would be so much grateful. Thanks for your time !!
@KevinPeters
@KevinPeters Год назад
I use react hook form for my forms as most of them are rather dynamic and I need validation while the user fills it out. Therefore I don’t use form actions at all and instead dispatch my mutations on submit. I loose progressive enhancement but I gain the ability to use react-query which has a useMutation Hook that I make use of. That hook takes a mutationFn which is just the server action.
@MrBrandenS
@MrBrandenS Год назад
Very cool. Can you share the workaround for next auth?
@HimanshuGogoi
@HimanshuGogoi Год назад
Please can u share how u setup the next-Auth workaround inside server action. I have been trying to figure it since yesterday.
@Dev-Siri
@Dev-Siri Год назад
One important note: Make sure to put them in a different file/fetch SECRETs inside it. server actions are in alpha stage, so they are not suited for production, and they currently have a security vulnerability that happens if you pass the action as a closure. Something like this: export default async function Page( ) { const c = await fetchCredentials( ); async function serverAction(fd: FormData) { "use server"; const items = processStuff(c.userSecret); } } Possesses a security vulnerability since Next.js will include it in the headers (maybe from the headers, I know it is possible to view the credentials in the HTTP request from the devtools). If you have any code using this style, you need to be careful, for now you need to move the action out of the page component or fetch the details for now: async function action(fd: FormData) { const c = await fetchCredentials( ); const items = processStuff(c.userSecret); } export default function Page( ) { return ... } Once server actions become stable, they can be used as closure just like client component functions, but for now, you have to do this prevent leaking credentials.
@dealloc
@dealloc Год назад
And if you pass it to a form action it will also add it as hidden elements. Hidden inputs are useful to keep state around from page request to the form request, which means it likely was meant as a "feature", but a feature with a huge footgun.
@appstuff6565
@appstuff6565 9 месяцев назад
thank you
@ryanp787
@ryanp787 8 месяцев назад
Hey Jack, love the video! I am still trying to wrap my head around why we would use server actions in a server component, to lets say call the database, when any normal function in a server component is ran server-side already.
@jherr
@jherr 8 месяцев назад
Right, a server action is a function that is sent to client components and which gets run on the server when the client component calls it.
@banjoallstars
@banjoallstars Год назад
Being a web developer for 15+ years, I’m confident that the best way to build apps is building a decoupled API first. It allows you to swap out either the front end or the backend independently. Less vendor lock in.
@ivanakcheurov
@ivanakcheurov Год назад
@jherr what do you think of this? Wouldn’t Server Actions create the same problem: we had crappy APIs in 2000s because the web apps were not created API-first but rather API-later?
@henrybenedict6357
@henrybenedict6357 Год назад
Up
@antoniors
@antoniors Год назад
Up
@ChoperComand
@ChoperComand Год назад
Although English is not my native language and I am not fluent, your pronunciation and didactic approach are really excellent, which allowed me to understand everything. Congratulations on a great job!!!
@jherr
@jherr Год назад
Thanks! And you got me beat of English with the use of "didactic". :)
@CleverGeneration
@CleverGeneration 6 месяцев назад
You literally answered all my questions on this topic! I'm very grateful, thank you!
@indrajitsarkar3169
@indrajitsarkar3169 Год назад
I was waiting for app dir to be stable before I start using next 13, now I'll be waiting for server actions to be stable. Good times.
@house2113
@house2113 Год назад
best server action tutorial on youtube. Good Work.
@sshnavin
@sshnavin Год назад
Thank you for keeping up with the updates! Super helpful.
@73TheWhiteWolf
@73TheWhiteWolf Год назад
Awesome! I hope you will continue with such videos about NextJS 13.
@jherr
@jherr Год назад
I probably will, but I have to say I'm so surprised at how poorly these videos are doing. NextJS is usually a home run content wise, but people seem put off by it?
@missthechris
@missthechris Год назад
Could you show us some react-query patterns with the new app directory?
@ivodelev9794
@ivodelev9794 Год назад
This would require client components to use, but you can wrap the query client in the root layout, and work from there, what i normally do is this method, and then use context inside each route layout to have easy access to data on client components
@Pptruenoz
@Pptruenoz Год назад
There's no need for react query with server components model
@mahmoudhosain9542
@mahmoudhosain9542 Год назад
We need this
@faraonch
@faraonch Год назад
Is react-query still needed? As a heavy user, I dare to say but... I see a pattern here :)
@qlebevillon
@qlebevillon Год назад
I don't know what you would need react-query in a server components environnement. The state is the server.
@xtremescript
@xtremescript Год назад
Can't wait until NextJS becomes an MVC framework :D
@CFXTBogard
@CFXTBogard Год назад
Tell me it is PHP without saying it is PHP.... WHAT HAPPENED HERE???
@Flash136
@Flash136 Год назад
Why is there a white flash when you revalidate the path?
@plart2006
@plart2006 Год назад
yep, looks like old fashioned page reload
@kikevanegazz325
@kikevanegazz325 Год назад
There is one thing that gets my attention and is that new technologies always come along to reduce the gap between users and data. We want instant access regardless of the device and bandwidth. However, a delay is always a case and is always considered, some kind of loading state, or transition. It's like the dog chasing its own tail metaphor but on rolling blades. (random comment)
@jordondax
@jordondax Год назад
This was great, Jack! Classic pokemon lol
@GeorgiiArutiunov
@GeorgiiArutiunov Год назад
I have a question about revalidatePath fn, do you know is that possible did update on few pages in Server Action? For example : revalidatePath('/home'); revalidatePath('/about'); Or it is possible on ur path right now? I try, and it not work for me I still have cached data on other link, may be I miss something or just not understand correct. Didnt find answer in docs next 13.4
@GeorgiiArutiunov
@GeorgiiArutiunov Год назад
Very good video, thank you !
@9622AX
@9622AX Год назад
Can u make a short tutorial website in next 13.4 Combining all these new features. That would be very helpful. Thanks
@user-hg1hm6ln1f
@user-hg1hm6ln1f Год назад
Hi Jack, when I assign the server action to the form's action prop, it shows this error: `Type '(data: FormData) => Promise' is not assignable to type 'string'`. Can you give me some advices to troubleshoot it?
@hamzandev9482
@hamzandev9482 Год назад
Most awesome video about server action
@caio6837
@caio6837 Год назад
great video, really thankyou
@sirawichvoungchuy3128
@sirawichvoungchuy3128 Год назад
Wonder if we use Axios instead fetch it will still cache for us or not ?
@mpbros.official
@mpbros.official 2 месяца назад
You are the best!!!
@EricMasiello
@EricMasiello Год назад
Is it possible to use an abort controller with server actions? With a search form, if I debounce the input but send the request automatically on keyup, I'd like to abort any inflight requests to avoid race conditions. Is that possible?
@KWerder92
@KWerder92 Год назад
Great video as always! Thanks!
@jherr
@jherr Год назад
Thank you!!!
@cunningham.s_law
@cunningham.s_law Год назад
how would this work on vercel? I assume these are serverless. So you would get different todo lists?
@yusril-ihsanul-alim
@yusril-ihsanul-alim Год назад
Does Qwik's routeAction$ function perform the same actions as this one?
@wiseman9960
@wiseman9960 Год назад
What is this from action attribute assigned a function? Where can I read more? As per the docs it should be string URL
@DanielPham-iz3rf
@DanielPham-iz3rf Год назад
I cloned your source code and run. But it had an error: "Error: backingFormData.forEach is not a function" when submitting the simple post form. Would you like to recheck it?
@berkaycirak
@berkaycirak Год назад
Thanks for your great content. I have question about server and client side components. Since every component inside the app folder is a server component and executed from the server first. When I mark a component with "use client" as a client component and run the program, will that client component also first pre-rendered on the server and then rendered on the client for hyration as well ? I ask that question since when I write a console.log("hello") inside the client component, it logs both client and server sides. I assumed that the client component ( which is marked with "use client") only runs on the browser instead of pre-rendering on the server.
@jherr
@jherr Год назад
"Client" components are run both on the server and the client.
@PostMeridianLyf
@PostMeridianLyf Год назад
I can only aspire to have hair this good.
@thecodecatalyst
@thecodecatalyst Год назад
Hey Jack thanks for the Zact recommendation, it rocks. (also for the vid)
@thecodecatalyst
@thecodecatalyst Год назад
Do you have a "Props must be serializable" warning on the form post with transition's AddButton's props?
@27sosite73
@27sosite73 Год назад
thank you!
@user-bu6fc2bn1e
@user-bu6fc2bn1e Год назад
Is useFormStatus scoped to the form it's called or is it some global thing and it's going to disable all buttons on the page if any form is submitted?
@dougjones5607
@dougjones5607 Год назад
"Let's re-enabled javascript, because we are not crazy." Lol Love it.
@cas818028
@cas818028 Год назад
It’s like MS Ajax from 2008 but for react!
@veliea5160
@veliea5160 Год назад
how do you clean the input values after submitting the action?
@jgoon3
@jgoon3 Год назад
When you pass a server action as a prop to a client component, does this pose a security vulnerability? I'm assuming next has thought of this and implemented safeguards, but I'm curious how it's done. I would assume something along the lines of interpreting the server action as a fetch to the virtual server action endpoint.
@jherr
@jherr Год назад
The mechanism is a straight fetch to the server. So the same security issues apply to other NextJS based API endpoints.
@Max7Houston
@Max7Houston Год назад
I'm getting a typescript error when I try and pass my action function into the form. " Type 'Promise' is not assignable to type 'string' " Any ideas how to fix this?
@PanosPitsi
@PanosPitsi Год назад
dont try to put a function inside a string 🥶🥶
@SysmKzz
@SysmKzz Год назад
Is this going to replace tRPC? What's your thoughts on this?
@thisweekinreact
@thisweekinreact Год назад
Nice 👌 Huge win for progressive enhancement in React! No useOptimistic demo? 🤪
@jherr
@jherr Год назад
Maybe in another one.
@VictoriousVipin
@VictoriousVipin Год назад
Can we use App Router for production ready application? Or it is too early to use app router and we should use pages router?
@jherr
@jherr Год назад
I think you can now. It’s not going anywhere, it’s definitely the future. There are some rough edges but the core features are stable.
@javiervazquezfernandez1872
@javiervazquezfernandez1872 Год назад
Hi Jack! Great content! Im playing around a little bit with server actions, and everything works in the happy path, but... how can we manage validation errors? For example, the todo has to be longer than 4 chars or to make the form empty after submit, thanks!
@jherr
@jherr Год назад
You should probably validate that client side using something like react-hook-form and use server validation as a last resort. In the action, I'm not sure what throwing an error would do, maybe generate a 500? And may that would come back as an exception on the client? That would be cool. Otherwise you could respond with an object that has a success flag and appropriate error messages.
@javiervazquezfernandez1872
@javiervazquezfernandez1872 Год назад
​@@jherr Hi again! Sorry for the late response, but I was playing around this concept during a couple of days and I think I have some meaningful insights: Context about my objectives : - I wanted to use my domain entities to the single source of validation either for client and server operations - I wanted to dont couple my react use-cases components with the "use server" function that is clearly coupled to nextjs (with the usage of revalidate path) And I ended up with the following approach: - The "use server" function can return plain objects (as needs to navigate through the http request) so, im returning in case of mutation a type "undefined | error" so I can handle things like "unexpected error" or "username already taken" that is imposible to handle client-side. - This treat this function the same way I treat services/repositories, I use dependency inversion to be able to mock that function at test time As note: If you throw on the "use server" function, the request will be a 500 and you can catch that error at client side, but as that error is unknown, I preferred the approach of sending it as a valid payload of the request. Anyway, I think will be a big challenge for big projects the alignment between the different teams on how, where and when to use either client or server functions and do it in the right way without too much coupling and allowing the testing.
@Ouyiggh8807
@Ouyiggh8807 Год назад
So how can we make form validations the component is server
@abdelrahmanmagdy3706
@abdelrahmanmagdy3706 Год назад
I really appreciate your videos thanks a lot I just have one question regarding using server action with a form, how can i show an err message on client in case an err occurred in the server action
@lautarodapin
@lautarodapin Год назад
in last example, could the initial list of names of pokemon be pass from props from the server component?
@murraybauer3535
@murraybauer3535 Год назад
Using actions for the search example was interesting verses just using an RSC. Probably a video in that as to pros cons.
@ABC-ip6jq
@ABC-ip6jq Год назад
What do you mean with "versus just using an RSC"?
@Zechey
@Zechey Год назад
Weird how useFormStatus is throwing me "Error: (0 , react_dom__WEBPACK_IMPORTED_MODULE_2__.experimental_useFormStatus) is not a function". Guess I have to settle with the loading page for now
@ayushjain7023
@ayushjain7023 Год назад
Hey Jack, again a commendable work on the video loved it, Am I wrong or you said it incorrectly at 14:05 that server function runs on both server and client, I think they only run on server once invoked ? 🤔
@jherr
@jherr Год назад
No worries. I said "it runs on the server as opposed to running on the client".
@ayushjain7023
@ayushjain7023 Год назад
Aaah , 😅 I heard it “as well as”, thanks for the clarification, you are best ❤
@HorizonHuntxr
@HorizonHuntxr Год назад
Where is the todo data being stored? If I can access it across browsers and you said its not session storage then how?
@jherr
@jherr Год назад
It's in memory on the server.
@logistics_guy
@logistics_guy Год назад
Like it.
@underflowexception
@underflowexception Год назад
im confused couldn't we do this in the past?
@appstuff6565
@appstuff6565 9 месяцев назад
This is amazing! Can you do a signin form submission that works with useformstatus?
@camiloperillanino6636
@camiloperillanino6636 Год назад
how come after reloading, the variable storing the todos has two todos? My first thought is after a reload, the variable resets to its initial state
@jherr
@jherr Год назад
Reloading the page? That's not changing the server state. The server state is what has the todos.
@camiloperillanino6636
@camiloperillanino6636 Год назад
⁠@@jherrohhh got it, so that variable lives in the server, reloading the page has no impact whatsoever
@quincyyy334
@quincyyy334 Год назад
I really love your videos, by the way how did you pin the network tab at the top of arc browser?
@jherr
@jherr Год назад
That happens automagically when you open up a localhost like (at least it does for me)
@tamimjabr1648
@tamimjabr1648 Год назад
Really good video. thank you! How can I empty text input after submitting form using server action?
@maelsoom
@maelsoom Год назад
In something like the PokemonList example, where there isn't any secrets involved, will you prefer to do client-side fetching (e.g. with react-query) or server-side with API routes/server actions?
@jherr
@jherr Год назад
Not enough information to make a recommendation on that.
@liu-river
@liu-river Год назад
I think it comes down to whether you need SEO for that page, if you want quick and dirty, no SEO involved then just use client. I doubt you will see real world difference fetching a pokemon list either client or server side, if you app is huge and the js bundle gets shipped to client is also huge then you may need to start thinking server side render to reduce that js file size to improve speed.
@MrEnsiferum77
@MrEnsiferum77 Год назад
Can server components help, we get rid of useEffect?
@sunny7268
@sunny7268 Год назад
Are actions only for native form tags or also for libs like MUI and Chakra?
@liu-river
@liu-river Год назад
You do know that any UI lib uses native HTML elements in the source code? So the answer is yes, but then you job is to figure out the imprementation.
@nemanjazivaljevic1656
@nemanjazivaljevic1656 Год назад
Does revalidate path reloads whole page?
@valour.se47
@valour.se47 Год назад
are these server functions some how vendor locks you ?
@jherr
@jherr Год назад
Kinda, but they could easily be replaced with API calls.
@akshaylachake3282
@akshaylachake3282 Год назад
Great Video Sir, can you please list down VS code extensions you use?
@oloja__
@oloja__ Год назад
nice video. what browser is that though
@zugbob
@zugbob Год назад
Because it's refreshing the page would it be possible to animated the adding of the todo? I feel like this prevents you from doing some cool animation stuff.
@jherr
@jherr Год назад
I'm not actually sure it reloads the page.
@beakerbkr
@beakerbkr Год назад
The thumbnail looks 3d, pretty cool effect. Was this intentional?
@dagonzalez1757
@dagonzalez1757 Год назад
I don't understand how writing "use server" can change its behaviour. What's the magic behind that?
@Dev-Siri
@Dev-Siri Год назад
✨Compilation ✨
@dealloc
@dealloc Год назад
These are directives. A standard syntax of JavaScript (see "use strict"). These directives are picked up through static analysis and upon compilation split into files served only for the given boundary. For "use client" you have to specify it per file (not per scope, unfortunately) since it is a module boundary (it's served to the browser) whereas "use server" can be defined in both file and function scopes.
@dagonzalez1757
@dagonzalez1757 Год назад
@@dealloc Thanks
@linshen4658
@linshen4658 Год назад
Coule you show us how to integrate swagger with the new app directory?
@VitaliiKhotei
@VitaliiKhotei Год назад
Could you please show with database usage in actions? Because it is a more tricky thing, when you need to open a connection, then close it ?:)
@EduCodigosPro
@EduCodigosPro Год назад
Hi!, do you have any videos with adonis js framework?
@jm7476
@jm7476 Год назад
Maybe a little bit off-topic , but what is that vs code theme? I just love it!
@tzarger
@tzarger Год назад
Look in video description
@muhammadsaad7965
@muhammadsaad7965 Год назад
We want video of your studio which is very peaceful lovely❤
@vcothur7
@vcothur7 Год назад
Does this mean I can share types with the client and my server without any extra steps? 🤯
@domw2391
@domw2391 Год назад
how do you think qwik vs next 13.4. Seems one for performance, another one for community, it is very hard to choose for next project
@RolandAyala
@RolandAyala Год назад
Same dilemma here -- undecided nextjs 13 vs qwik for my next project so have been developing same project in both to form my own impression and understand limitations for my specific use cases. I prefer Qwik in almost every way, considering framework alone, but lacks next/react ecosystem & community. Interestingly, resumabilty is what drove me to try qwik (out of curiosity), but not a reason for me to stay since can achieve similar page load times w/ Nextjs w/ a little extra work, The biggest thing I like about qwik over next 13 app router is you don't have the client/server divide for interactive (i.e., no need to breakout a component into "use client" just because has onClick), and as great as the nextjs/react ecosystem is, support for appdir is limited or non-existent in some cases. E.g., if want to use headless ui, your app effectively becomes client rendered by the time you're done, and trcp is not supported at all (although server actions addition make less needed if OK using alpha feature for time being). After using both frameworks side-by-side for a few months now, I'm strongly leaning towards using qwik, but it is not an easy decision for me.
@domw2391
@domw2391 Год назад
@@RolandAyala thank you for detail analysis on this. Yes, both of them has their own advantages and you are right. It is quite a bit annoy in splitting use client in some interaction. But to some extend , next13 has its own convenience. It’s hard…
@MattHeslington
@MattHeslington Год назад
Cheers Jack. Is it me or is revalidating causing the whole page to reload?
@jherr
@jherr Год назад
It's just invalidating the cache.
@Michael-gv7dr
@Michael-gv7dr Год назад
Awesome video as always...but this is kinda gross tbh. I came to React to get away from Rails and I may go back to Rails.
@JustSall
@JustSall Год назад
Awsome 🎉
@ahmedAltariqi
@ahmedAltariqi Год назад
What's your terminal?
@abhilashm5236
@abhilashm5236 Год назад
Can you please do a video on PWA with next.js 13.4
@TranzendDotEth
@TranzendDotEth Год назад
To what extent do you think this obviates react-query?
@jherr
@jherr Год назад
In some cases, sure. Though... I think you could use react-query to monitor the promise returned by a server action function. Hmmmm...
@babayaga6172
@babayaga6172 Год назад
Please give a example of authentication jwt in new nextjs 13 ! 🥺
@nickross4059
@nickross4059 Год назад
I'm having 2008 flashbacks. Next is becoming exactly what all the old MVC frameworks were. I'd advise everyone to look at why we moved away from them.
@SeaRich
@SeaRich Год назад
action is still string required, so weird.
@leepowelldev
@leepowelldev Год назад
I think Remix got server actions right - not convinced by Next's approach at the moment.
@maelsoom
@maelsoom Год назад
Must server actions always be POST?
@jherr
@jherr Год назад
Nope, GET with query works too.
@maelsoom
@maelsoom Год назад
Yes I got that semantically you could query for data using Server Actions. But how does it let the developer distinguish between a HTTP POST vs a HTTP GET request? E.g. in previous versions of API routes you could get that from the incoming request's 'method' parameter in the body of the handler function.
@jherr
@jherr Год назад
@@maelsoom I think you don't define that if you're using server actions. You're letting the system handle that distinction. If you want to control that then use a router handler instead.
@maelsoom
@maelsoom Год назад
I see, seems like it'll always be POST. Thanks.
@patite3103
@patite3103 Год назад
Awsome video!
@user-lk9rg5cs4k
@user-lk9rg5cs4k Год назад
My question is, how revolutionary is this, why is this released now and couldnt be done earlier? And whats the use case for this?
@jherr
@jherr Год назад
Not very revolutionary because a lot of other frameworks have had this for a while. Not sure why it was specifically done now, just good to see. And there are lots of use cases for this for micro-APIs required to drive the frontend, like search queries, paging, form posts where you don't have direct access to the microservice APIs etc. etc
@golf-and-surf
@golf-and-surf Год назад
php > react > back to php
@xxXAsuraXxx
@xxXAsuraXxx Год назад
I heard server action is leaking secrets.
@jherr
@jherr Год назад
I think it's possible. I haven't vet that fully yet myself.
@NeoCoding
@NeoCoding Год назад
thanks, for me it's better to split shorter videos, transitions explanation brain already been slept
@shekoofehshojai9534
@shekoofehshojai9534 11 месяцев назад
tanks please git hub?
@Dylan_thebrand_slayer_Mulveiny
That "use server" syntax is hacky as hell. Giant turn off. Couple that with the security vulnerability in the pinned comment, I would HIGHLY recommend not using this.
@greendsnow
@greendsnow Год назад
Eeerrrrm. But we have something like this in Sveltekit and it works better and safer than this...
@dagonzalez1757
@dagonzalez1757 Год назад
Then use it?
@mughees1965
@mughees1965 Год назад
but svelte has less jobs than react
@Dev-Siri
@Dev-Siri Год назад
ok?
@sno-oze
@sno-oze Год назад
I didn’t see a single real example for application in the video, some fictional things, and I don’t understand what is wrong with this innovation
@snailsfrogslegs119
@snailsfrogslegs119 Год назад
I truly dislike "server actions". An API should be developed and thought out as an easily defined and maintained interface to the client(s) that use it. This is an obfuscation that makes that very difficult. ...no thanks.
@hamzaking127
@hamzaking127 Год назад
How to use server this code const [coin,setCoin]=useState({}) const params = useParams(); const url = `ht**************om/api/v3/coins/${params.coinId}?tickers=false&sparkline=true`; useEffect(()=>{ axios.get(url).then((response)=>{ setCoin(response.data) }) },[url])
@jherr
@jherr Год назад
There is a Discord server associated with this channel. You can ask your question there. Please read and follow the #rules before posting. FWIW, useEffects don't run on the server.
Далее
How To Fix NextJS 13's N+1 Problem
27:52
Просмотров 34 тыс.
No const! How NOT To Give A JavaScript Talk
10:28
Просмотров 61 тыс.
🍏 Устарели ОФИЦИАЛЬНО! 🤡
00:32
React 19's useOptimistic: EVERYTHING you NEED to know
25:24
ShadCN’s Revolutionary New CLI
12:11
Просмотров 20 тыс.
Mastering React Context: Do you NEED a state manager?
37:26
Next.js Server Actions...  5 awesome things you can do
7:51
The Untold Story of VS Code
12:42
Просмотров 10 тыс.
What Next.js doesn't tell you about caching...
13:32
Просмотров 11 тыс.
How to ACTUALLY Secure Your API (5 Steps)
7:42
Просмотров 60 тыс.
When to use server actions in Next JS 14
5:28
Просмотров 9 тыс.
Don't Learn Machine Learning, Instead learn this!
6:21