Giter Club home page Giter Club logo

simple-rsc's Introduction

Simple RSC โš›๏ธ

A simple React Server Components implementation that you can build yourself ๐Ÿ™Œ

Watch the live demo with Dan Abramov here!

โญ๏ธ Goals

  • ๐ŸŒŠ Show how React server components are streamed to the browser with a simple Node server.
  • โš™๏ธ Demo a build process to bundle server components and handle client components with the "use client" directive.
  • ๐Ÿ“ Reveal how a server component requests appear to the client with a developer panel.

Getting started

First, install dependencies with "peer dependency" errors disabled:

npm i --legacy-peer-deps

This is due to experimental version conflicts. React Server Components are still quite new!

Then, start the Node development server:

npm run dev

This should trigger a build and start your server at http://localhost:3000.

Project structure

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.js

๐Ÿ™‹โ€โ™€๏ธ What is not included?

  • File-based routing conventions. This repo includes a single index route, with support for processing query params. If you need multiple routes, you can try NextJS' new app/ directory.
  • Advance bundling for CSS-in-JS. A Tailwind script is included for playing with styles.
  • Advice on production deploys. This is a learning tool to show how React Server Components are used, not the bedrock for your next side project! See React's updated "Start a New React Project" guide for advice on building production-ready apps.

simple-rsc's People

Contributors

bholmesdev avatar gaearon avatar deathstar10 avatar tusheer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.