TLDR Web Dev · ARTICLES & TUTORIALS

HOW IMPORTS WORK IN RSC

overreacted.io23 min read

Summary from the TLDR Web Dev newsletter

React Server Components (RSCs) extend JavaScript's module system to span both client and server, using directives like 'use client' and 'use server' to clearly define where code runs. Instead of copying code between environments, these directives act like controlled entry points, while “poison pills” like server-only or client-only imports prevent accidental leaks by causing build-time errors. This creates two separate but connected module systems, allowing safe code sharing and controlled data flow between frontend and backend.