This is an implementation of React server components inspired from Dan Abramov's writeup about it. I followed along all the 6 steps mentioned, and also implemented all the 8 challenges listed at the end.
It required nodejs version above 20
. And to run any step or challenge in this repo, follow these steps.
- In
package.json
, change the dev script path to wanted step. For example to run step4
"dev": "nodemon -- --experimental-loader ./src/step4/node-jsx-loader.js ./src/step4/server.js",
- First install dependencies
yarn
. Then runyarn dev
, and openhttp://localhost:5005
on your browser.
-
In
package.json
, change thestart:rsc
andstart:ssr
paths, for example to run step6"start:rsc": "nodemon -- --experimental-loader ./src/step6/node-jsx-loader.js ./src/step6/server/rsc.js", "start:ssr": "nodemon -- --experimental-loader ./src/step6/node-jsx-loader.js ./src/step6/server/ssr.js"
-
First install dependencies
yarn
. Then runyarn start
and openhttp://localhost:5005
on your browser.
P.S: I don't have README files for steps because I think Dan Abramov's blog has done a great job explaining the implementation details.