diff --git a/README.md b/README.md index e7da7ae..9349a92 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,20 @@ # Zact - Zod Server ACTions -We like NextJS Server Actions. We wanted to love them. This package makes them validated and typesafe, so you can use them in things that aren't forms. +We like Next.js Server Actions. We wanted to love them. This package makes them validated and type-safe, so you can use them in things that aren’t forms. -`npm install zact` +```shell +npm install zact +``` + +### Back End -### Backend ```ts // action.ts "use server"; import { z } from "zod"; import { zact } from "zact/server"; + export const validatedAction = zact(z.object({ stuff: z.string().min(6) }))( async (input) => { return { message: `hello ${input.stuff}` }; @@ -18,7 +22,8 @@ export const validatedAction = zact(z.object({ stuff: z.string().min(6) }))( ); ``` -### Client WITH custom hook +### Client WITH Custom Hook + ```ts // component.tsx "use client"; @@ -41,8 +46,9 @@ export const zactTestComponent = () => { }; ``` -### Client WITHOUT custom hook -Yes you can just import them and call them like promises too +### Client WITHOUT Custom Hook + +Yes, you can also just import them and call them like promises: ```ts // component.tsx @@ -51,7 +57,6 @@ Yes you can just import them and call them like promises too import { validatedAction } from "./action"; export const zactTestComponent = () => { - return (