A simple React Server Components implementation that you can build yourself
A simple React Server Components implementation that you can build yourself
A simple React Server Components implementation that you can build yourself.
Watch the "build from scratch" code-along video to learn how all of the pieces fit together. Or... just read the in-line documentation in this codebase :)
"use client" directive.Install dependencies using npm and start the Node development server:
npm i
npm run devThis should trigger a build and start your server at http://localhost:3000.
dev scriptYou'll notice the dev script maps to the following command in the package.json:
node --conditions react-server server.jsThe --conditions flag is part of the Node.js conditional exports system. This allows packages to export different versions of a module depending on your environment.
When passed react-server, react-server-dom-esm will expose a server-only module that omits React's client-side or browser-specific APIs, ensuring compatibility with the server-rendered environment.
This project is broken up into the app/ and server/ directories. The most important entrypoints are listed below:
# Your full-stack application
app/
page.jsx # server entrypoint.
_client.jsx # client script that requests and renders your `page.jsx`.
# Your backend that builds and renders the `app/`
server.jsapp/ directory.No open issues yet, or sync has not completed.