Загрузка видео...

Не удалось загрузить видео

На главную

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 просмотров • 2 лет назад •via X (Twitter)

Комментарии: 10

Фото профиля Eelco Wiersma
Eelco Wiersma2 лет назад

@ryanflorence Source code here:

Фото профиля Kyle Gill
Kyle Gill2 лет назад

That create page function looks 👌

Фото профиля Eelco Wiersma
Eelco Wiersma2 лет назад

Thanks Kyle!

Фото профиля Chris Ribeiro
Chris Ribeiro2 лет назад

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

Фото профиля Eelco Wiersma
Eelco Wiersma2 лет назад

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

Фото профиля Renato Ribeiro
Renato Ribeiro2 лет назад

@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?

Фото профиля Eelco Wiersma
Eelco Wiersma2 лет назад

@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.

Фото профиля JB Hutch
JB Hutch2 лет назад

@nextjs @ryanflorence Ooh I like this!

Фото профиля Dale
Dale2 лет назад

@nextjs @ryanflorence Oh this is a great idea!

Фото профиля Chris Eagle
Chris Eagle2 лет назад

@nextjs @ryanflorence I like this

Похожие видео