rsf-zero
v0.3.6
Published
A minimal micro-framework with React Server Functions support
Readme
RSF Zero
A minimal micro-framework with React Server Functions support.
Installation
yarn add rsf-zero
# or
pnpm add rsf-zero
# or
npm install rsf-zeroThen follow setup.
Quick intro to Server Functions
React Server Functions allow you to mark functions to run on the server:
'use server';
// Server function
export const addComment = async (comment: Comment) => {
await db.comment.create(comment);
}import { addComment } from './addComment.ts';
export const AddCommentButton = (comment: Comment) =>
<Button onClick={() => addComment(comment)} />More examples
See /example/src/App.tsx.
Reference Docs
- React Server Functions
- Note: only the top-level
'use server'is implemented by this framework.
Motivation
RSF Zero is designed to be a dead simple micro-framework.
Read the blog post for the motivation behind it.
🕊 Minimal: Add whatever you want on top, nothing bundled that you don't use
🕊 Simple: Add 'use server' to run something on the server, and you're done, nothing new to learn
🕊️ Done: Instead, spend your spare time sipping a tea or looking at a nice bird
