Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap
Nextjs server actions just got better with the library next-safe-action. In this video, I show the before and after code of a refactor with next-safe-action and how it helps clean up the code when using Next.js Server Actions.
💖 Support me on Patreon ➜ https://patreon.com/davegray
⭐ Become a full-stack web dev with Zero To Mastery Courses:
- Complete Next.js Developer: https://bit.ly/CompNextJSDev
- Advanced React: https://bit.ly/AdvReactDev
- Junior to Senior Dev Roadmap: https://bit.ly/WebDevRoadmap-JrtoSr
🚩 Subscribe ➜ https://bit.ly/3nGHmNn
📬 Course Updates ➜ https://courses.davegray.codes/
❓ Questions - Please post them to my Discord ➜ https://discord.gg/neKghyefqh
☕ Buy Me A Coffee ➜ https://www.buymeacoffee.com/davegray
🔗 Starter Source Code: https://github.com/gitdagray/nextjs-form-modal
🔗 Refactored Source Code: https://github.com/gitdagray/next-safe-action-example
🔗 My Next.js Videos: https://www.youtube.com/playlist?list=PL0Zuz27SZ-6Pk-QJIdGd1tGZEzy9RTgtj
👇 Follow Me On Social Media:
GitHub: https://github.com/gitdagray
Twitter: https://twitter.com/yesdavidgray
LinkedIn: https://www.linkedin.com/in/davidagray/
Nextjs Server Actions Just Got Better with next-safe-action
(
00:00) next-safe-action
(
00:08) Before: Original Client-Side UserForm
(
01:57) After: Refactored Client-Side UserForm
(
05:53) Before: Original Server Action
(
07:16) After: Refactored Server Action
(
09:20) Set up for the actionClient
(
10:04) Possible Drawbacks
(
11:48) Wrap up
📺 Video References:
🔗 Next.js Form Modal:
https://youtu.be/WyL_Jc6_-sY
📚 Tutorial References:
🔗 My Blog Post: https://www.davegray.codes/posts/nextjs-server-actions-with-next-safe-action
🔗 next-safe-action: https://next-safe-action.dev/
🔗 Next.js: https://nextjs.org
🔗 Next.js Server Actions: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations
🔗 Zod: https://zod.dev/
Was this tutorial about refactoring your Next.js Server Actions with next-safe-action helpful? If so, please share. Let me know your thoughts in the comments.
#nextjs #server #actions