Vite RSC experiments
MIT License
Wire together all the pieces needed to build a proper app using vite and RSC. Implement the necessary router, bundler plugins and build setup to get an SSR'ed React app with RSC.
Eventually we want extract the pieces into modular parts for other vite based frameworks to use. So, implement a Vite plugin for React Server Components.
Ideally hitting the sweet spot between full-fledged yet flexible. Can we design the plugin so that it works with Wakuwork, Astro, Rakkas, and vite-plugin-ssr?
useMutation
hook
function Component({ action }) {
let mutate = useMutation()
function handleClick() {
mutate(() => action())
}
}
Currently, the main attraction is the Contacts Demo. To run:
pnpm install # at root
cd examples/contacts
pnpm dev
app
: User code
root.tsx
: Root server component, declares routes and renders matched routemodules
: Framework modules
vite
: Vite plugins for RSC and integrating Hattiprouter
: Main framework
server.ts
: Server handler, /__rsc
endpoint for RSC stream, and other endpoints are per user's routingclient.ts
: Client side router, handles navigation and hydrationExisting implementations: