Nextjs

June 13, 2023

Nextjs 13

Crash Course (Why You Should Use Next?)

Installation

Folder Structure

Public

App

Routing Tutorial (App Router)

Layouts and Components

Layouts

Components

Loading

Error

Rendering Explained (Server side and Client side)

Styling (Global and Module CSS)

Image Explained

const nextConfig = {
    images: {
        remotePatterns: [
            {
                protocol: 'https',
                hostname: 'images.pexels.com',
            },
        ],
    },
}

App UI Design

Dark/Light Mode Tutorial

Context API Tutorial (App Router)

return (
    <ThemeContext.Provider value={{ toggle, mode }}>
        <div className={`theme ${mode}`}>{children}</div>
    </ThemeContext.Provider>
);

Data Fetching Explained (Static, Dynamic)

How to Fetch Data on the Client Side? (SWR Tutorial)

import useSWR from 'swr'

const fetcher = (url: string) => fetch(url).then((res) => res.json());

const Dashboard = () => {
    const { data, error, isLoading } = useSWR(
        "https://jsonplaceholder.typicode.com/posts",
        fetcher
    );
}

How to Fetch Data from Local Json File?

type paramsType = {
    params: { category: string };
};

const getData = (cat: string) => {
    const data: itemType[] = items[cat as keyof itemTypes];

    if (data) {
        return data;
    }

    return notFound();
};
const Category = ({ params }: paramsType) => {
const data = getData(params.category);

MongoDB Full Stack App Tutorial

API Folder and CRUD Operations (App Router)

SEO Tutorial (Static and Dynamic SEO)

Auth Tutorial (New App Router)

Google Auth (Sign in with Google)

Credentials Auth (Sign in with Email and Password)

Protected Routes with Auth.js

Admin Dashboard Tutorial

SWR Mutation_articles/Nextjs.mdx

Related:

← Back to home