DEV Community

Zod en el servidor y en el cliente: el schema que creés una vez y las tres formas en que se rompe en runtime (opens in new tab)

Zod en el servidor y en el cliente: el schema que creés una vez y las tres formas en que se rompe en runtime El 80% de los proyectos Next.js que usan Zod tienen el mismo schema importado desde tres contextos distintos. Y solo uno de esos tres contextos se comporta exactamente como Zod promete. Sí, leíste bien. El modelo mental de "definí el schema una vez y validá en todos lados" es verdad en la librería, pero en un stack real con Next.js 16 —Server Actions, edge middleware y API routes— apar...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help