ReasonJun

React : Understanding React Server Components 본문

Frontend/React

React : Understanding React Server Components

ReasonJun 2023. 9. 10. 13:48
728x90

Server Actions: React’s first steps into mutability

Within the context of RSCs, Server Actions are functions that you define in an RSC on the server side that you can then pass across the server/client boundary. When a user interacts with your app on the client side, they can directly call Server Actions which will be executed securely on the server side.

 

This approach provides a seamless Remote Procedure Call (RPC) experience between the client and the server. Instead of writing a separate API route to communicate with the server, you can directly call Server Actions from your Client Components.

 

Keep in mind, too, that the Next.js App Router is built entirely around smart data caching, revalidating, and mutating. Server Actions in Next.js mean you can both mutate the cache and update the React tree in the same roundtrip request to the server—all while maintaining client cache integrity through navigation.

 

Specifically, Server Actions are designed to handle tasks like database updates or form submissions. For example, they can progressively enhance your forms, which means that even if JavaScript hasn’t loaded yet, the user can still interact with the form, and Server Actions will handle the submission and processing of the form data.

 

The opportunities that Server Actions offer, both for progressive enhancement and eliminating development work on APIs, are great for accessibility, usability, and developer experience.

Let Next.js do the heavy lifting

Next.js is the first framework to integrate the entire React architecture for Server Components, Server Actions, Suspense, Transitions, and all else that has changed with the release of RSCs.

 

While you focus on building your product, Next.js uses strategic streaming and smart caching to make sure your application rendering stays non-blocking and serves dynamic data at top speeds.

 

Next.js strives to stay on the cutting edge of new React features without sacrificing stability, reliability, and backward compatibility. It will continue to offer smart defaults for your team to iterate quickly while maintaining flexibility and scalability for projects of any scope.

 

https://www.youtube.com/watch?v=g5BGoLyGjY0&t=64s 

 

https://vercel.com/blog/understanding-react-server-components

 

Understanding React Server Components – Vercel

React Server Components are changing the fundamental paradigms of React. Learn how Next.js handles the complexities and improves the performance of your applications.

vercel.com

 

728x90

'Frontend > React' 카테고리의 다른 글

React : createPortal  (0) 2024.07.13
React : useLayoutEffect  (0) 2023.10.07
React18 : How React 18 Improves Application Performance in Detail  (0) 2023.09.09
React : context (state management)  (0) 2023.08.11
React.FC and JSX.Element  (0) 2023.07.12
Comments