
React Server Components Have a Free Data Fetching Model — No More useEffect Waterfalls
useEffect → fetch → loading spinner → another useEffect → another fetch → another spinner. React Server Components end this waterfall permanently. What Are React Server Components? RSCs run exclusively on the server. They can directly access databases, file systems, and APIs — then send the rendered HTML to the client. No loading spinners. No client-side fetch calls. Why RSCs Change Everything 1. Direct Database Access in Components // This component runs on the server — never ships to the browser async function UserProfile ({ userId }: { userId : string }) { const user = await db . users . findUnique ({ where : { id : userId } }); const posts = await db . posts . findMany ({ where : { authorId : userId } }); return ( < div > < h1 > { user . name } </ h1 > < p > { user . bio } </ p > < PostList posts = { posts } /> </ div > ); } No API route. No useEffect . No loading state. The HTML arrives ready. 2. Zero Client-Side JavaScript // Server Component — 0 KB shipped to browser async funct
Continue reading on Dev.to React
Opens in a new tab


