Coder Social home page Coder Social logo

agusjkdev / nextjs-appdir-snippets-extension Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 51 KB

Next.js App Directory Snippets Extension. Get it now!

Home Page: https://marketplace.visualstudio.com/items?itemName=agusjkdev.nextjs-appdir-snippets

License: MIT License

JavaScript 100.00%
extension nextjs react snippets

nextjs-appdir-snippets-extension's Introduction

Next.js App Directory Snippets Extension

Snippets

Typescript

comp (React Component)

Sets component name to the PascalCase version of the file name by default.
navigation-menu.tsx
interface NavigationMenuProps {}

export default function NavigationMenu(props: Readonly<NavigationMenu>) {
    return <span>NavigationMenu</span>;
}

acomp (Asynchronous React Component)

Sets component name to the PascalCase version of the file name by default.
theme-switch.tsx
interface ThemeSwitchProps {}

export default async function ThemeSwitch(props: Readonly<ThemeSwitchProps>) {
    return <span>ThemeSwitch</span>;
}

compc (React Component With Children)

Sets component name to the PascalCase version of the file name by default.
menu-wrapper.tsx
interface MenuWrapperProps {
    children: React.ReactNode;
}

export default function MenuWrapper({ children }: Readonly<MenuWrapperProps>) {
    return <span>{children}</span>;
}

acompc (Asynchronous React Component With Children)

Sets component name to the PascalCase version of the file name by default.
form-container.tsx
interface FormContainerProps {
    children: React.ReactNode;
}

export default async function FormContainer({ children }: Readonly<FormContainerProps>) {
    return <span>{children}</span>;
}

rlayout (Next.js Root Layout)

Basic Next.js Root Layout setup.
app/layout.tsx
import type { Metadata } from "next";

export const metadata: Metadata = {
    title: "Title",
    description: "Description",
};

export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
    return (
        <html lang="en">
            <body>{children}</body>
        </html>
    );
}

arlayout (Asynchronous Next.js Root Layout)

Basic Next.js Root Layout setup but this time with the async keyword. Use in case you want to fetch server-side data.
app/layout.tsx
import type { Metadata } from "next";

export const metadata: Metadata = {
    title: "Title",
    description: "Description",
};

export default async function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
    return (
        <html lang="en">
            <body>{children}</body>
        </html>
    );
}

layout (Next.js Layout)

Sets layout name to the PascalCase version of the parent folder name + Layout by default.
dashboard/layout.tsx
export default function DashboardLayout({ children }: Readonly<{ children: React.ReactNode }>) {
    return <div>{children}</div>;
}

alayout (Asynchronous Next.js Layout)

Sets layout name to the PascalCase version of the parent folder name + Layout by default. This time with the async keyword. Use in case you want to fetch server-side data.
devices/layout.tsx
export default async function DevicesLayout({ children }: Readonly<{ children: React.ReactNode }>) {
    return <div>{children}</div>;
}

page (Next.js Page)

Sets page name to the PascalCase version of the parent folder name + Page by default.
pricing/page.tsx
export default function PricingPage({
    params,
    searchParams,
}: Readonly<{
    params: { slug: string };
    searchParams: Record<string, string | string[]>;
}>) {
    return <span>PricingPage</span>;
}

apage (Asynchronous Next.js Page)

Sets page name to the PascalCase version of the parent folder name + Page by default. This time with the async keyword. Use in case you want to fetch server-side data.
settings/page.tsx
export default function SettingsPage({
    params,
    searchParams,
}: Readonly<{
    params: { slug: string };
    searchParams: Record<string, string | string[]>;
}>) {
    return <span>SettingsPage</span>;
}

Javascript

comp (React Component)

Sets component name to the PascalCase version of the file name by default.
navigation-menu.jsx
export default function NavigationMenu(props) {
    return <span>NavigationMenu</span>;
}

acomp (Asynchronous React Component)

Sets component name to the PascalCase version of the file name by default.
theme-switch.jsx
export default async function ThemeSwitch(props) {
    return <span>ThemeSwitch</span>;
}

compc (React Component With Children)

Sets component name to the PascalCase version of the file name by default.
menu-wrapper.tsx
export default function MenuWrapper({ children }) {
    return <span>{children}</span>;
}

acompc (Asynchronous React Component With Children)

Sets component name to the PascalCase version of the file name by default.
form-container.jsx
export default async function FormContainer({ children }) {
    return <span>{children}</span>;
}

rlayout (Next.js Root Layout)

Basic Next.js Root Layout setup.
app/layout.jsx
export const metadata = {
    title: "Title",
    description: "Description",
};

export default function RootLayout({ children }) {
    return (
        <html lang="en">
            <body>{children}</body>
        </html>
    );
}

arlayout (Asynchronous Next.js Root Layout)

Basic Next.js Root Layout setup but this time with the async keyword. Use in case you want to fetch server-side data.
app/layout.jsx
export const metadata = {
    title: "Title",
    description: "Description",
};

export default async function RootLayout({ children }) {
    return (
        <html lang="en">
            <body>{children}</body>
        </html>
    );
}

layout (Next.js Layout)

Sets layout name to the PascalCase version of the parent folder name + Layout by default.
dashboard/layout.jsx
export default function DashboardLayout({ children }) {
    return <div>{children}</div>;
}

alayout (Asynchronous Next.js Layout)

Sets layout name to the PascalCase version of the parent folder name + Layout by default. This time with the async keyword. Use in case you want to fetch server-side data.
devices/layout.jsx
export default async function DevicesLayout({ children }) {
    return <div>{children}</div>;
}

page (Next.js Page)

Sets page name to the PascalCase version of the parent folder name + Page by default.
pricing/page.jsx
export default function PricingPage({ params, searchParams }) {
    return <span>PricingPage</span>;
}

apage (Asynchronous Next.js Page)

Sets page name to the PascalCase version of the parent folder name + Page by default. This time with the async keyword. Use in case you want to fetch server-side data.
settings/page.jsx
export default function SettingsPage({ params, searchParams }) {
    return <span>SettingsPage</span>;
}

nextjs-appdir-snippets-extension's People

Contributors

agusjkdev avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.