1. 4
    Create a Application Layout in Next.js and Cart Page
    1m 11s

Create a Application Layout in Next.js and Cart Page

Shadid Haque
InstructorShadid Haque
Share this video with your friends

Social Share Links

Send Tweet
Published 2 years ago
Updated 2 years ago

Our application code is still pretty bare at this point. For a shop application, we'll want a consistent Nav bar. We'll wrap that Nav around our existing code in _app.js to have a consistent nav across all pages.

In this lesson, I paste in the presentational code with all the Tailwind pre-written. This course isn't about crafting UIs so we skim past this part, I encourage you to dig around the Nav component if you want to see how I did that.

Shadid Haque: [0:00] Let's create a new navbar for our application. I'm going to create a new folder called components. Inside components, I'm going to create a new file called Nav.tsx. In this file, we're going to add some pre-written code for the navbar. The focus of this course is not CSS. That's why we added these pre-written components.

[0:21] Let's go ahead and add this Nav Component to our _app.tsx file. This way, the navbar will appear in every pages. We have not created the cart page yet. That's why we're seeing this, "404. This page could not be found."

[0:46] Let's go ahead and create a cart page to view our cart. Under pages directory, we create a new file called cart.tsx. Here we add a simple React component with some text.