From the course: Next.js: Creating and Hosting a Full-Stack Site
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Data loading basics in Next.js - React.js Tutorial
From the course: Next.js: Creating and Hosting a Full-Stack Site
Data loading basics in Next.js
- [Instructor] All right, so now that we've added MongoDB to our route handlers, it's time for us to take a look at how to bring the front and back-ends of our application together. So, currently, we have the front-end of our application, which is the pages, and a sort of back-end to our application, which is the route handlers we've created, which are in charge of loading and responding with certain types of data. Now, what we want here is for our pages to actually load their data from those route handlers, right, by sending requests to those route handlers, and the main way that this is done in Next.js is by using the fetch function. If you're not already familiar with the fetch function as you may be from working with JavaScript or regular React, we're going to be taking a look at it in the context of Next.js here, and it's pretty exciting because in Next.js, the fetch function is actually much more powerful than the regular browser fetch function, because it allows us to do both…
Contents
-
-
-
-
-
-
(Locked)
Data loading basics in Next.js1m 13s
-
(Locked)
Loading data with Fetch5m 57s
-
(Locked)
Loading all products3m 39s
-
(Locked)
Loading individual products3m 9s
-
(Locked)
Loading shopping cart items6m 16s
-
(Locked)
Adding items to the cart10m 5s
-
(Locked)
Shopping cart improvements6m 2s
-
(Locked)
Challenge: Removing items from the cart1m 28s
-
(Locked)
Solution: Removing items from the cart5m 34s
-
(Locked)
-
-