reactNextjsGenerator.templates.page |
Template for Next.js page component |
string |
import React from 'react';
export default async function Page({params,searchParams,}: {
params: { slug: string | string[] };
searchParams: { [key: string]: string | string[] | undefined };
}) {
return (
<div>
<h1>Page</h1>
</div>
);
};
export async function generateMetadata({
params,
searchParams,
}: {
params: { slug: string | string[] };
searchParams: { [key: string]: string | string[] | undefined };
}): Promise<Metadata | undefined> {
return {};
}
|
reactNextjsGenerator.templates.layout |
Template for Next.js layout component |
string |
import React from 'react';
export default async function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<div>
<header>Header</header>
<main>{children}</main>
<footer>Footer</footer>
</div>
);
};
|
reactNextjsGenerator.templates.error |
Template for Next.js error component |
string |
import React from 'react';
export default function Error() {
return (
<div>
<h1>Error: Something went wrong</h1>
</div>
);
};
|
reactNextjsGenerator.templates.loading |
Template for Next.js loading component |
string |
import React from 'react';
export default function Loading() {
return (
<div>
<h1>Loading...</h1>
</div>
);
};
|
reactNextjsGenerator.templates.reactComponent |
Template for React component |
string |
import React from 'react';
import styles from './{fileName}.module.css';
export type {fileName}Props = {{}};
export const {fileName}: React.FC<{fileName}Props> = () => {{
return (
<div className={styles.container}>
{fileName} Component
</div>
);
}};
|
reactNextjsGenerator.templates.reactComponentCss |
Template for React component CSS module |
string |
.container {
/_ Add your styles here _/
}
|
reactNextjsGenerator.templates.reactComponentTest |
Template for React component test file |
string |
import React from 'react';
import { render } from '@testing-library/react';
import {fileName} from '../{fileName}';
test('renders {fileName} component', () => {{
render(<{fileName} />);
}});
|