2 min read

Create Reusable React Components / Next.js Website with Tailwindcss and Cursor AI

Video tutorial on creating reusable React components using Tailwindcss and Next.js: extract inline code into standalone components, introduce parameters and reusable code, and refactor using Cursor AI.
Create Reusable React Components / Next.js Website with Tailwindcss and Cursor AI
Reusable React components with Tailwindcss and Next.js

Create reusable React components for a Next.js Website with Tailwindcss and Cursor AI

[ 3+ videos and homework | Duration: 40-50 mins | Preview demo ]

In this part of the tutorial series, we will refactor inlined components into separate files and standalone React components. Each component includes input parameters and can be reused in other parts of the project or for another project.

ℹ️
This tutorial is part of the full course series on building a web app using Next.js and Cursor.ai (for beginners).

Public course content includes:

1. Start development with Next.js, React, and Tailwindcss using Cursor.ai
2. Create an app using Next.js, React, and Tailwindcss
3. Add bare minimum UI elements to the website: Header, Footer, and Content Area
4. Introduce reusable React components --- THIS POST
5. Add extra pages and connect them using the Next.js Link
6. Publish the website using Vercel

Join with membership or purchase the entire course to access all course materials: complete source code, step-by-step changes, homework, and solutions.

This video tutorial consists of the following video tutorials:

  1. Creating reusable components with Tailwindcss based on existing inline code.
  2. Utilizing layout.tsx and adding new pages with the Next.js app router.
  3. Using usePathname from Next.js Navigation for the NavBar menu link selection.
  4. Reuse navigation links and autoselect the current page.

Video Tutorial 1: Create reusable React components with TailwindCSS

Includes:

  1. Refactor the header as a standalone component and move it into a separate file (copy links).
  2. Refactor the footer as a standalone component and move it into a separate file (copy links).

Video Tutorial 2: Next.js Layout and create new pages with app router

Includes:

  1. Create new Next.js pages (about and products) and use the created components
  2. Start utilizing the layout.tsx and other pages

Video Tutorial 3: Dynamic NavBar navigation with config using Next.js usePathname

  1. DRY principle.
  2. Introduce params for each component.
  3. Reuse links and provide them as a parameter for each component.
  4. "Dynamically" change menu items.
  5. Use a configuration file.

Two more videos are in progress:

  1. Rewrite the header as a custom component with Tailwindcss (replace TailwindUI components).
  2. Add ThemeToggle to demonstrate a reusable component.

Additionally, this tutorial series explains:

  • Why is splitting up the <page.tsx> necessary?
  • Advantages and Disadvantages of reusable components.
  • Component parameters.
  • Quick overview of the browser storage.

Follow-ups to improve your skills after this section

🔐 Source Code, Homework Excercise, and Solution

This tutorial includes homework, a solution for the homework, and complete source code.

All CoderVlogger.com paid members are eligible to access all course materials with extra steps.

Additionally, you can buy complete course materials and source code with a one-time payment (coming soon; subscribe for announcement).

This post is for paying subscribers only