Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

Been using a similar pattern for a long time in the Next.js, but now with the app router we can also add a loader function that's executed in a server component. (Thanks Ryan Florence for the inspiration) ✅ Infer/validate params/searchParams from Zod schema. ✅ Infer data

22,573 Aufrufe • vor 2 Jahren •via X (Twitter)

10 Kommentare

Profilbild von Eelco Wiersma
Eelco Wiersmavor 2 Jahren

@ryanflorence Source code here:

Profilbild von Kyle Gill
Kyle Gillvor 2 Jahren

That create page function looks 👌

Profilbild von Eelco Wiersma
Eelco Wiersmavor 2 Jahren

Thanks Kyle!

Profilbild von Chris Ribeiro
Chris Ribeirovor 2 Jahren

@nextjs @ryanflorence Look nice! CreatePage is a public library?

Profilbild von Eelco Wiersma
Eelco Wiersmavor 2 Jahren

@nextjs @ryanflorence Yeah will release it in the next days 👌

Profilbild von Renato Ribeiro
Renato Ribeirovor 2 Jahren

@nextjs @ryanflorence What happens if zod can't parse params/searchParams? It will pass down type as `z.infer<T> | undefined`, it will throw or it will show a pre-defined error ui page?

Profilbild von Eelco Wiersma
Eelco Wiersmavor 2 Jahren

@nextjs @ryanflorence Right now it will throw and render error.tsx if it exists. But other options like a safe mode is also a consideration.

Profilbild von JB Hutch
JB Hutchvor 2 Jahren

@nextjs @ryanflorence Ooh I like this!

Profilbild von Dale
Dalevor 2 Jahren

@nextjs @ryanflorence Oh this is a great idea!

Profilbild von Chris Eagle
Chris Eaglevor 2 Jahren

@nextjs @ryanflorence I like this

Ähnliche Videos