~/talk

Enhancing Forms with React Server Components

Talkat JS Poland 2024 · on Thursday, 2024-11-07· [react, frontend-architecture]
slides:none on file

Demo builds a message form inside Next.js app router using React Server Components with Prisma for DB, Zod for runtime validation, and Tailwind for styling and shows how server functions (use server) power the form action plus revalidatePath to refresh content without a full reload. A client-only automatic scroller and a small hidden userId input are the only JS sent to the browser. use action state drives error and pending UI while use optimistic performs instant client updates that roll back when the user exceeds 5 messages.

AI-written summary · about

  1. 0:00Introduction to talk
  2. 1:56What are React Server Components
  3. 2:39Key React 19 features for forms
  4. 4:54Demo setup and message box
  5. 5:57Making form work with server actions
  6. 8:43Adding auto-scrolling to messages
  7. 9:45Validating form data with Zod
  8. 10:49Handling errors with error boundary
  9. 12:12Using useActionState for server feedback
  10. 13:57Adding error toasts and fallbacks
  11. 14:39Preventing form reset on submit
  12. 15:23Disabling button during pending state
  13. 16:27Testing form without JavaScript
  14. 17:10Progressive enhancement explained
  15. 17:51Adding optimistic UI updates
  16. 19:36Summary and conclusion
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.