Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[19] s/"Server Action"/"Server Function" #7180

Open
wants to merge 2 commits into
base: v19
Choose a base branch
from

Conversation

rickhanlonii
Copy link
Member

Overview

Note: please don't screencap this until it lands, looking at you @slorber 👀

These docs are a proposal to re-name "Server Actions" to "Server Functions" in the docs starting in React 19.

If you review the changes here, you can actually see the reason this makes sense: Many of the calls to "use server" functions are not actions.

For example, this example from the Server "Action" docs is not an Action:

"use client";
import {createNote} from './actions';

function EmptyNote() {
  console.log(createNote);
  // {$$typeof: Symbol.for("react.server.reference"), $$id: 'createNoteAction'}
  <button onClick={() => createNote()} />
}

This is just calling a server function on click. Really, it should be converted to an Action for better UX.

What are Server Actions then

Server Actions are Server Functions used in an Action context. For example, there are three examples on the Server Function page in this PR that show:

  • Using Server Functions with Actions
  • Form Actions with Server Functions
  • Server Functions with useActionState

Redirect

This change redirects links to "/server-action" to the 18 docs, which I'll add a callout for saying it's been renamed. We should also probably update the 19 blog post with a note about the name change.

Copy link

vercel bot commented Sep 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
19-react-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 23, 2024 8:23pm
react-dev ✅ Ready (Inspect) Visit Preview Sep 23, 2024 8:23pm

Copy link
Member

@sophiebits sophiebits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…are server components server functions

vercel.json Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants