Currently Empty: £0.00
Congratulations! You’re on the brink of entering the fast-evolving world of NextJS, designed to empower developers with the tools to create high-performance, feature-rich web applications that stand out in the modern digital landscape.
NextJS is the key to unlocking the full potential of server-rendered React applications, combining the best of web development into one powerful, developer-friendly framework. This comprehensive course takes you on a deep dive into advanced NextJS features that can set you apart in the job market, equipping you to tackle real-world projects with confidence. By exploring the intricacies of authentication with the Next-Auth library, the innovative approach to data mutations using server actions, and the foundational concepts of server and client components, you’ll be well on your way to mastering modern web development.
With the tech industry looking for skilled professionals, mastering Next puts you at the forefront of opportunity, with a skill set that’s in high demand. Whether you’re eyeing a new career as a software engineer or aiming to enhance your existing projects, there’s never been a better time to delve into Next.
What will you achieve?
Through an extensive collection of video lectures complemented by detailed diagrams and real-world examples, this course ensures a thorough understanding of Next’s capabilities, no pre-existing knowledge of the framework necessary. I’ve crafted a learning experience that’s both rigorous and encouraging, with layers of knowledge built one at a time and ample dialogue to contextualize each feature of Next.
I proudly offer the most detailed journey through Next available online. No stone is left unturned in this resource-packed adventure.
Prepare to conquer a diverse array of topics, including:
-
Implementing user authentication flows with next-auth, for secure and scalable user management
-
Effectively structuring server actions to handle data mutations
-
Dissecting the theory of server vs client components, and knowing how to leverage each for maximum efficiency
-
Mastering data validation techniques to ensure the reliability and integrity of user input
-
Navigating Next’s sophisticated caching systems to deliver lightning-fast content performance
-
Recognizing the critical differences between development and production environments and preparing your applications for successful deployment
-
Tailoring Server-Side Rendering (SSR) and Static Site Generation (SSG) to your application’s needs
-
Utilizing Incremental Static Regeneration (ISR) for the best of SSR and SSG
-
Enriching user interfaces with TailwindCSS support for styling components
-
Optimizing images on-the-fly with Next’s Image component for better performance and user experience
-
Deploying your Next applications with Vercel and other hosting platforms with ease
-
Leveraging TypeScript with Next for robust, type-safe applications
With each new topic, you’ll gain knowledge, proficiency, and the assurance to apply what you’ve learned to practical scenarios.
Embrace the opportunity to define the future of web development with your newly acquired NextJS expertise. Join the ranks of developers who not only follow best practices but also contribute to them. Sign up now and transform your understanding and execution of modern web development with Next.
Changing Data with Mutations
-
1How to Learn NextJS Quickly
Explore the capabilities of Next.js to create both dynamic and static websites. Understand the shift from using React.js primarily for interactive applications, to leveraging Next.js for content-driven sites. Learn the importance of Next.js features that may seem complex or redundant, but are crucial for building static web experiences alongside dynamic ones.
-
2Project Overview
Explore the first application mockups, revealing hidden complexities in seemingly simple NextJS projects. Uncover advanced concepts while navigating the structure of a static cloud hosting marketing page. Discuss the project initiation process, delve into generating a new NextJS app with `NPX create-next-app`, and understand the default configuration options and their implications on the setup.
-
3File-Based Routing
Explore the initial project setup and take the first steps in file-based routing using Next.js. Learn to navigate the code editor, start the development server, and understand how to manipulate the `page.tsx` files to display different content based on the user's current path. Delve into the structure of the `SRC/app` directory, the significance of `page.tsx` files, and the conventions for defining new routes and pages within a Next.js application.
-
4Adding Additional Routes
Explore how to set up multiple pages in a Next.js application using the framework's file-based routing system. Learn the process of creating specific 'page.tsx' files within designated folders to establish routing rules that correspond to distinct paths, allowing the display of different pages based on the user's navigation.
-
5Linking Between Pages
Explore the use of Next.js's built-in Link component to create navigable links between pages in an application. Learn the proper import statements required from the Next library and gain insights into the subtle complexities of using the Link component, which, while similar to a traditional anchor tag, provides enhanced functionality for routing in Next.js applications.
-
6Common UI in Next JS with Layouts
Utilize the layout.tsx in NextJS to manage common UI elements across multiple pages. By moving navigation links into a global layout component, all pages inherit the same header without duplication. This approach centralizes UI changes and ensures consistent site-wide navigation, showing how to leverage Next.js' page rendering process for efficient UI management.
-
7Project Structure Strategy
Explore the process of extracting repeated JSX into a reusable Next.js component to maintain clean and understandable project structure. This lesson demonstrates transitioning a set of links from a layout file into a separate header component, addressing concerns about organization and clarity in the project directory by utilizing the `src` folder.
-
8Absolute Path Import Shortcut
Explore a convenient solution to manage relative imports in Next.js projects by leveraging the '@' shorthand to reference the SRC directory–a strategy to simplify and streamline deeply nested file paths within the NextJS framework, ensuring cleaner and more maintainable code structures.
-
9Image Files + Import Update
-
10Adding Images in Next JS
Explore the utilization of the Next.js Image component to optimize the display of images within a web application. Learn how to properly import and implement the component to ensure images are responsively and efficiently loaded, and discover strategies to style these images for full-screen backgrounds and overlay text.
-
11More on the Image Component
Dive into the intricacies of the Next.js Image component, understanding how it prevents layout shifting and ensures correct sizing. Learn about sizing strategies such as using local image dimensions, assigning height and width props, or utilizing the 'fill' prop to make images responsive and maintain layout integrity before and after image loading.
-
12Adding a Reusable Presentation Component
Enhance the visual styling and consistency of a Next.js application by creating a new reusable 'Hero' component. This component will standardize the presentation of background images and centered heading text across various pages. Learn to define the component with TypeScript interfaces, pass image data and strings as props, and use Next Image for optimized image handling.
-
13Adding Some Styling
Discover a streamlined approach for duplicating page setup in a Next.js application by copying and pasting a template and updating critical components like names, image imports, and alt text. Also, learn about the image loading delay during development and get a glimpse into resolving this with an upcoming solution. Lastly, enhance the header with additional styling using Tailwind CSS for a polished look.
-
14Production Deployment with Vercel
Explore the process of deploying a Next.js application using Vercel, from stopping the development server to running the 'npx vercel' command for setup and project configuration. Learn about the simplicity of deploying with Vercel, including linking a Vercel account, defining project settings, and understanding the behavior of the Next.js image optimization after deployment. Get insights on how images are processed and cached to improve load times on subsequent visits.
-
15Join Our Community!
-
16Course Diagrams
Streaming Content with React Server Components
-
17App Overview
Explore the development of a Next.js application focused on creating, saving, editing, and deleting code snippets. Learn to build a multi-page app that enables users to manage and share code snippets with ease, understanding the fundamentals of data listing, CRUD operations, and link sharing for code collaboration. The project begins by setting up a new Next.js application named 'snippets'.
-
18Project Setup
Discover how to persist data in a Next.js application by integrating a local SQLite database using Prisma. Learn step-by-step how to install Prisma, initialize it with SQLite, and define a new data model within the schema.prisma file. Understand how to run Prisma migrations to create the database and prepare for CRUD operations on snippet data.
-
19Adding a Create Page
Continue with the initial project setup by simplifying the global.css file and streamlining the page.tsx to display just the "home page" text. Then, start building the 'Create Snippet' page to allow users to submit new code snippets at the designated route 'snippets/new' in the Next.js application, with a clear directory structure.
-
20Creating a Prisma Client within Next.js
Learn to create a form in Next.js that connects to a SQLite database using Prisma. Delve into setting up a Prisma client within a Next.js application, allowing for creation, editing, and deletion of records, demonstrated through building a snippet-saving feature. Discover how to structure database functionality in a dedicated directory for streamlined database operations.
-
21Adding a Creation Form
Learn to construct a snippet creation form using TypeScript and Tailwind CSS within a Next.js application. The course covers form elements, styling with Tailwind classes, handling input fields, and text areas to facilitate user entries. Also, examine the default form behavior in the browser and prepare for integrating server actions with form submissions.
Server Actions in Great Detail
-
22Introducing Server Actions in Next.js
Explore the implementation of server actions in Next.js to manipulate data within an application. Learn to create new records in a database using Prisma client, and dive into specifics like handling form submissions, validating form data, and redirecting users after successful data operations. Discover the special integration of server actions with HTML forms and TypeScript considerations for form data entry values.
-
23A Deeper Dive into Server Actions
Dive into the differences between traditional React applications and the Next.js framework. Explore the distinct execution environments for the code—some runs in the browser, while some stays on the server, like server actions. Understand the process of submitting a form, where code execution shifts from the browser to the Next.js server, and grasp the importance of recognizing the execution context of the code.
-
24Server Components vs Client Components
Unveil the nuanced differences between server components and client components in Next.js applications. This segment introduces the concept of server components, their optimized integration with NextJS, and how they use async/await for fetching data without hooks like useState or useEffect. Learn when to favor server components to enhance performance and the compelling reasons to employ client components for hooks and event handlers.
-
25Fetching Data with Server Components
Explore the use of server components in Next.js for efficient data fetching. Learn to create and configure a server component, utilize Prisma client for database queries, and render a list of data directly in a component. This walkthrough demonstrates fetching from a database without an HTTP request and outputting the data within the Next.js framework.
-
26Adding Dynamic Paths
Explore the process of expanding the Next.js application to include viewing, deleting, and editing snippets. Learn to create new pages that dynamically fetch data from the database based on the snippet ID passed in the URL, using Next.js dynamic routes. Discover how to capture URL parameters within components and the key steps to set up data fetching for individual items.
-
27Fetching Particular Records
Explore server-side data fetching with Next.js by creating async server components and interfacing with a database using a tailored query. Learn how to define TypeScript interfaces for structured props, handle data retrieval with database queries, and implement error handling for nonexistent data using the Next.js 'not found' function for user redirection to a custom 404 page.
-
28Custom Not Found Pages
Discover how to personalize the 404 'not-found' page in a Next.js application by creating a custom not-found.tsx component. Learn the significance of specially named files within the app folder and the hierarchal logic Next.js uses to display the appropriate not-found component based on directory structure. Explore handling of common use cases with dedicated components for loading and error states.
-
29Automatic Loading Spinnners
Discover how to enhance the user experience in Next.js applications by implementing a loading component. This tutorial covers the creation of the `loading.tsx` file and exporting a component that displays a loading indicator while server components fetch data, along with adding an artificial delay to simulate data fetching lag for testing the loading state effectively.
-
30A Few Quick Tasks
Enhance the user experience in a Next.js application by adding navigation links with the Link component from 'next/link'. Learn how to style these links for improved layout and user interaction, ensuring users can navigate to view individual snippets or create new ones, while maintaining a clean and organized code structure with proper use of JSX and helper files.
-
31Styling the Show Page
Learn to create a user-friendly view snippet page with styled headers, edit and delete options, and syntax-highlighted code blocks in Next.js. Master the styling techniques within the 'app snippets ID page.tsx' file, utilizing Tailwind CSS classes for a polished layout and preparing the groundwork to add interactive functionality to buttons.
-
32Linking to the Edit Page
Explore how to implement dynamic routing in Next.js by creating an Edit Snippet page that responds to user navigation to paths containing snippet IDs. Discover the process of handling wildcard parameters and converting them from strings to numbers, and learn how to use the Next.js 'Link' component to seamlessly navigate users to the correct edit page.
-
33Showing a Client Component in a Server Component
Explore advanced Next.js concepts by delving into a complex file dealing with various functionalities such as data fetching, displaying a dedicated code editor with React Monaco Editor, and handling data updates. Understand the necessity of async server components for fetching and preparing data, coupled with client components for interactive elements that require hooks and event handlers. Learn to integrate, pass down data as props, and set up the necessary environment to render these components efficiently.
-
34Adding the Monaco Editor
Explore the integration of Monaco Editor React component into a Next.js application, diving into the documentation to comprehend its usage. Learn how to install the component and set up editor props such as height, language, default values, and the onChange event handler to manage the state of the code being edited, preparing for server-side updates.
-
35Handling Editor Changes
Enhance the editor component in Next.js by adding an onChange prop to capture user input. Address the nuances of TypeScript when dealing with potential 'undefined' values, ensuring the proper handling of editor changes. Demonstrate the use of the useState hook from React to maintain state within a client component, in preparation for future server action integration.
Server Forms with the UseFormState Hook
-
36Server Actions in Nextjs Client Components
Learn how to save changes to a code snippet in a Next.js snippet edit form by using server actions. Understand the limitations of defining server actions within client components and explore two strategies to circumvent them: passing server actions from parent server components or defining them in a separate actions.ts file for better organization and code reuse.
-
37Server Actions in a Separate File
Explore the process of separating server actions from client components in Next.js applications. Learn to create a dedicated 'actions' directory and an 'index.ts' file, where server directives and database interactions using Prisma are defined. Discover patterns for importing server actions into client components, such as using the edit snippet action within a snippet edit form.
-
38Options for Calling Server Actions from Client Components
Explore different methods for invoking server actions from client components in Next.js. Delve into the intricacies of using state rather than form elements to pass data to server actions, leveraging JavaScript's bind function to streamline the process. Additionally, examine an alternative technique that employs the startTransition function for non-form user interactions, ensuring data sync before navigation. Decide which approach aligns best with unique project requirements, keeping in mind the traditional React patterns and scenarios where JavaScript may be disabled in the browser.
-
39Calling a Server Action from a Client Component
Learn to execute the first option for updating data in a Next.js application by wiring up a server action with Prisma. Explore how to handle necessary arguments in server actions using `bind` to preload server action functions with arguments like snippet IDs and code strings. Enhance the snippet edit form to invoke these functions and use Prisma to update the snippet in the database, followed by redirecting users with `next/navigation`.
-
40Deleting a Record with a Server Action
Explore the implementation of a delete functionality in a Next.js application. The video covers the creation of a new server action using Prisma to delete database records and illustrates the process of redirecting users post-deletion. Learn to integrate server actions with UI components, utilizing form data and the `bind` function to ensure proper argument passing to server-side logic.
Understanding Next's Caching System
-
41Understanding the UseFormState Hook
Explore form validation in Next.js for server-rendered forms that work without JavaScript in the user's browser, using the `useFormState` hook from React DOM library. Learn how to handle form validation and error messaging between server actions and page components to ensure a robust user experience.
-
42UseForm State in Action
Explore the process of refactoring a Next.js page to utilize the `useFormState` hook for a client component and migrate server actions to a centralized file for better organization. Learn how to handle form state and server actions, including type annotations for form state properties, and observe the seamless functionality even when JavaScript is disabled.
-
43Adding the Form Validation
Explore the implementation of validation in a Next.js server action file. Learn to improve form data integrity by manually validating string inputs like 'title' and 'code', ensuring they meet specific length requirements. Understand how to return informative error messages, re-render components server-side, and style the UI to display these messages clearly to users.
-
44Gotchas Around Error Handling in Nextjs
Learn advanced error handling techniques in Next.js, particularly when dealing with server actions and database operations. Discover how to gracefully handle errors like validation failures and database connection issues. Explore creating a custom error.tsx file for global error state representation and the proper usage of try-catch blocks in server actions to return informative error messages without disrupting the user experience.
Authentication with Next-Auth
-
45Super Unexpected Behavior
Discover the crucial steps for preparing a Next.js application for production by simulating a deployment on a local machine. Learn how to build the project with npm run build, analyze the output to understand routes, and start the server in production mode using npm run start to observe how application behavior changes significantly from development mode.
-
46The Full Route Cache System
Explore the challenges of caching in Next.js, specifically when dealing with dynamic data on static routes. Understand the implications of Next.js's full route cache for production builds and how it can lead to stale data without proper configuration. Learn the necessity of adjusting the caching strategy for a real-time, data-driven home page and the steps to address it in future modules.
-
47What Makes a Static or Dynamic Route in Next.js
Explore how Next.js distinguishes between static and dynamic routes based on specific criteria such as cookie modifications, query strings, and dynamic paths. Delve into the use of npm run build to identify route types, the significance of lambda and circle symbols, and methods like force dynamic to alter route behavior. Upcoming discussions will cover updating cached static routes as data changes.
-
48When to Use Each Cache Control
Dive into optimizing Next.js applications by understanding the intricacies of cache control. Explore three methods to manage static page rendering: time-based caching with `revalidate`, on-demand cache control via `revalidatePath`, and completely disabling caching for dynamic data requirements. Learn appropriate use cases for each technique to ensure updated content delivery without sacrificing performance benefits of caching.
-
49Help, My Page is Showing Old Data!
Learn how to implement on-demand cache control in Next.js using the revalidate path function from next/cache to ensure up-to-date content. Explore the decision process of when to retain cached pages or re-render them, with examples such as not needing to refresh the cache after editing a code snippet, versus revalidating the homepage on snippet creation or deletion to reflect updated content accurately. Revalidate path enables selective cache invalidation, balancing speed and content freshness.
-
50Enabling Caching with GenerateStaticParams
Explore the technique of enabling caching for dynamic pages in Next.js applications. Learn to use `getStaticPaths` with the `generateStaticParams` function to pre-render and cache dynamic routes at build time by fetching necessary data from a database, optimizing page load speeds despite initial dynamic nature.
-
51Caching Dynamic Routes
Explore the setup of `generateStaticParams` for static generation in Next.js, handling dynamic routes in the snippets show page. Learn to fetch data from a database, map ID values to string types to avoid type errors, and implement on-demand cache management to ensure that edited content is properly updated without sacrificing the speed of cached pages.
Using Data - Database Queries
-
52Next 14.2 Issues and Required Version
-
53Project Overview
Set the foundation for building a Reddit-like social media platform with Next.js by learning to construct a large-scale application. Explore the creation of essential features like user authentication, posting, commenting, and topic browsing. Also, delve into UI elements like modals for post creation, searchable content, and a dynamic topic creation form to ensure a robust user experience. Ensure code quality with thorough validation and error handling practices for real-world application standards.
-
54Critical Libraries in Our Project
Introduce three powerful libraries to enhance the NextJS application: Prisma for database access, Next UI for styled component integration with Tailwind CSS, and NextAuth (auth.js) for comprehensive authentication management. Emphasize the streamlined process of using SQLite for database interaction and GitHub OAuth for user authentication. Prepare for detailed setup instructions for each library to follow.
-
55NextUI Installation and Setup
-
56Prisma Schema File
-
57Database Setup
Dive into the initial Prisma setup for a Next.js application, including installing and initializing the Prisma client library. Replace the auto-generated schema.prisma with a pre-constructed file to define database models for SQLite. Conclude with creating the database via Prisma migrations and setting up the Prisma client for database operations within the application.
-
58OAuth Setup
Dive into the setup of the authentication system using NextAuth.js, with a focus on integrating GitHub OAuth for user authentication in a Next.js application. Learn to create an OAuth app on GitHub, retrieve a client ID and client secret, and configure environment variables. Also, understand the importance of the authorization callback URL for a seamless sign-in process and initiate the installation of necessary NextAuth.js packages with exact versions.
-
59Next-Auth Setup
The video elaborates on setting up authentication in a Next.js project, guiding through the creation of an auth.ts file which will centralize all authentication utilities. It covers the integration of NextAuth with GitHub OAuth and Prisma Adapter for user information storage and management within a SQL Lite database accessed via the Prisma client. The session highlights the configuration of environment variables, handling potential TypeScript errors, and preparing exportable handlers for sign-in and sign-out processes.
-
60The Theory Behind OAuth
Explore implementing OAuth authentication in Next.js by setting up API route handlers for GitHub's sign-in flow. Delve into the OAuth process, understanding user redirection, and how NextAuth.js uses access tokens and cookies to securely manage user sessions. Learn to configure route handlers that GitHub servers can interact with to authenticate users.
-
61Wrapping Auth in Server Actions
Explore the creation of server actions in a NextJS application to manage user authentication state, such as sign in and sign out processes. Learn how to encapsulate these actions within a clearly defined file structure, providing clarity for team collaboration and ease of understanding authentication manipulation within the project.
-
62Sign In, Sign out, and Checking Auth Status
Explore the essentials of user authentication in NextJS by learning to sign in/out users, authenticate on both server and client components, and handle OAuth authorization. Discover how to create forms that trigger authentication actions, verify user sessions, and share session data across client components using Next.js's context system and the `useSession` hook.
-
63Upfront Design Process
Dive into the intricacies of designing a robust Next.js application, addressing the challenges presented by the full route cache mechanism. This overview of an upfront design process emphasizes identifying routes, wildcard paths, and associated data, using mockups to map out a clear data structure to streamline production deployments and revalidation strategies.
-
64Why Path Helpers?
Explore the creation of path helper functions in Next.js to streamline route management. Learn their importance for medium to large projects, ensuring consistent path references and simplifying future route updates. Emphasize the benefits of readability, TypeScript validation, and efficiency in updating link components and revalidate path calls.
-
65Path Helper Implementation
Learn how to create path helpers in Next.js for efficient route management. The paths.ts file is introduced to hold functions that generate URLs for different components in the application, including home, topic display, post creation, and post display, with flexibility to add more as needed. The approach simplifies navigation and revalidation across the app.
-
66Creating the Routing Structure
Dive into setting up the foundational routing structure for a Next.js application by creating essential folders and page.tsx files based on previously defined routes. Establish a navigable framework to prevent 404 errors while constructing a file system for topic display pages, new post forms, and individual post views, ensuring a smooth developer experience when expanding the application's architecture.
-
67Stubbing Out Server Actions
Discover the process of identifying areas in a Next.js application where data changes occur, such as form submissions, and learn to create specific server action functions for these data manipulations. Explore efficient code organization by creating robust form handling and error management, and understand the benefits of file structuring for scalable server actions in NextJS.
-
68Planning Revalidating Strategies
Explore cache revalidation strategies in Next.js to ensure up-to-date content delivery. Learn how to decide which paths require revalidation after server actions, contrast time-based and on-demand revalidation methods, and implement comments as reminders to call the revalidate function for dynamic routes. This step prevents serving stale data to users and enables efficient data updates.
-
69Building the Header
Explore the process of building and iterating a complex header component in Next.js, beginning with basic features like navigation links, search input, and GitHub OAuth-based sign in/sign up buttons. Learn about potential challenges such as component size and caching, consider when to refactor into smaller components, and understand how to manage authentication state asynchronously.
-
70Displaying the Sign In and Sign Out Buttons
Enhance the header component in Next.js by dynamically displaying sign in and sign out buttons or a user profile image based on authentication status. Explore efficient ways to handle JSX rendering with React nodes and conditional logic, and implement user interaction elements with avatar components and navbar items. Address TypeScript type errors with suitable defaults to ensure seamless user experience.
-
71Enabling Sign Out
Explore practical integration of server actions in Next.js by implementing user sign-in and sign-out functionalities. Learn to handle user authentication by leveraging server-side actions inside forms, and utilize Next UI components like Popover to create an intuitive interface for session control. Discover potential issues with caching mechanisms like the full route cache when dealing with dynamic user data.
-
72More Caching Issues
Explore the nuances of caching in Next.js, focusing on the tradeoff between static and dynamic pages and the conditions that differentiate them. Delve into testing the application's build output to determine page types and uncover how authentication practices, particularly cookie modification, may inadvertently set pages as dynamic, challenging the preference for static rendering for performance gains. Consider strategies for effectively utilizing authentication while still leveraging static caching.
-
73Signout Issues with Next 14.2
-
74Static Caching While Using Auth
Uncover how to leverage client components in Next.js for authentication to enable static rendering of pages at build time. Learn to segregate cookie handling by moving authentication logic from a shared header to a client-side Header Auth component, utilizing the `useSession` hook from `next-auth/react` for session management, allowing for a static homepage without server-side dynamic dependencies.
-
75Creating Topics
Uncover the process of enhancing a Next.js application by introducing the ability to create new topics, complete with rigorous form validation integrated within server actions. Delve into the development of a 'New Topic' button complemented by a form featuring validation feedback, and explore organizing components within the project's structure for better maintainability.
-
76Creating a Popover Form
Explore the process of creating a user-interactive form in Next.js by integrating a button that triggers a popover with a basic form. Learn to utilize Next UI library components such as Input, TextArea, and Button to craft a 'Create Topic' form, and prepare to incorporate server-side actions for form submission and data creation.
-
77Receiving Form Data
Explore the process of handling form submissions in Next.js by setting up form elements with name attributes and extracting their data in server actions. Learn to implement comprehensive validation using a third-party library, ensuring users provide valid input and displaying errors to prompt corrections when necessary.
-
78Adding Form Validation with Zod
Explore schema validation in Next.js using ZOD, a third-party validation library. Learn to create schema objects using ZOD for robust data validation of various JavaScript data types. Understand how to use these schemas to validate user inputs and obtain detailed error reports, which can then be displayed to improve form submission feedback in Next.js applications.
-
79Reminder on the UseFormState Hook
Explore form validation in Next.js by integrating a custom hook called `useFormState` with the Zod validation library. Learn how to define initial states, handle user submissions, and display relevant error messages in the UI when validation fails, using JSX to render feedback directly beneath form fields.
-
80Fixing UseFormState Type Errors
Explore the process of adding form state management to Next.js components using the `useFormState` hook from React DOM. Learn how form state flows between client components and server actions, ensuring the consistency of object types and state values across the React component lifecycle. Uncover solutions to common TypeScript errors encountered when types mismatch during form state implementation.
-
81Here's Our FormState Type
Learn to coordinate complex TypeScript types across different parts of a Next.js application. Understand how to structure form state objects and define types that account for varying validation scenarios. Discover how to ensure type safety by returning compatible objects from server actions and aligning the initial state in custom hooks with the defined types.
-
82Displaying Validation Errors
Explore form validation techniques in Next.js applications, focusing on handling error states within forms. Learn to display validation errors to users using both standard methods and the built-in error display functionalities of Next UI components by setting props like `isInvalid` and `errorMessage` for a seamless user experience. Apply these validation patterns throughout server actions for consistency across the project.
-
83Handling General Form Errors
Learn to handle non-field-specific validation errors in Next.js applications by adding an `_form` property to the form state. Explore error handling for scenarios like unauthenticated user actions and database failures, and improve user feedback with appropriate error messages and enhanced UI styling using Tailwind CSS classes.
-
84Handling Database Errors in Forms
Learn how to save validated form data into a database using NextJS server action files and TypeScript. This includes adding topic creation functionality with Prisma, handling redirection with Next's navigation tools, and managing errors during the form submission process. The video also covers database revalidation for content updates and explores robust error handling for a seamless user experience.
How long do I have access to the course materials?
You can view and review the lecture materials indefinitely, like an on-demand channel.
Can I take my courses with me wherever I go?
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!
Stars 5
1348
Stars 4
441
Stars 3
66
Stars 2
10
Stars 1
10