@@ -18,22 +18,22 @@ NextJS and React Snippets with TypeScript support as well!🚀
1818
1919 ``` jsx
2020 const Component = () => {
21- return < div>< / div> ;
22- };
23- export default Component ;
21+ return < div>< / div>
22+ }
23+ export default Component
2424 ```
2525
2626### TypeScript
2727
28282. ` rafect` (React Functional Component with Types)
2929
3030 ` ` ` tsx
31- import { FC } from " react";
31+ import { FC } from ' react'
3232 interface Props {}
3333 const Component: FC<Props> = () => {
34- return <div></div>;
35- };
36- export default Component;
34+ return <div></div>
35+ }
36+ export default Component
3737 ` ` `
3838
3939## NextJS
@@ -46,8 +46,8 @@ NextJS and React Snippets with TypeScript support as well!🚀
4646 export const getServerSideProps = async (context) => {
4747 return {
4848 props: {},
49- };
50- };
49+ }
50+ }
5151 ` ` `
5252
53532. ` nextssg` (Get Static Props Next .js )
@@ -56,8 +56,8 @@ NextJS and React Snippets with TypeScript support as well!🚀
5656 export const getStaticProps = async (context) => {
5757 return {
5858 props: {},
59- };
60- };
59+ }
60+ }
6161 ` ` `
6262
6363### TypeScript
@@ -66,37 +66,45 @@ NextJS and React Snippets with TypeScript support as well!🚀
6666
6767 ` ` ` tsx
6868 export const getServerSideProps: GetServerSideProps = async (context) => {
69- return { props: {} };
70- };
69+ return { props: {} }
70+ }
7171 ` ` `
7272
73732. ` nextssgt` (Get Static Props Next .js )
7474
7575 ` ` ` tsx
7676 export const getStaticProps: getStaticProps = async (context) => {
77- return { props: {} };
78- };
77+ return { props: {} }
78+ }
7979 ` ` `
8080
81- 3. ` taytay ` (NextPage component with NextPage type )
81+ 3. ` nextgip ` (Get Initial Props in Next . js )
8282
8383 ` ` ` tsx
84- import type { NextPage } from "next";
84+ Page.getInitialProps = async (context) => {
85+ return { props: {} }
86+ }
87+ ` ` `
88+
89+ 3 ) ` taytay` (NextPage component with NextPage type)
90+
91+ ` ` ` tsx
92+ import type { NextPage } from 'next'
8593 const Page: NextPage = () => {
86- return <></>;
87- };
88- export default Page;
94+ return <></>
95+ }
96+ export default Page
8997 ` ` `
9098
91- 4. ` nextct` (Next JS Component with NextComponentType and Props)
99+ 4 ) ` nextct` (Next JS Component with NextComponentType and Props)
92100
93101 ` ` ` tsx
94- import type { NextComponentType, NextPageContext } from " next";
102+ import type { NextComponentType, NextPageContext } from ' next'
95103 interface Props {}
96104 const Component: NextComponentType<NextPageContext, {}, Props> = (
97- props: Props
105+ props: Props,
98106 ) => {
99- return <div></div>;
100- };
101- export default Component;
107+ return <div></div>
108+ }
109+ export default Component
102110 ` ` `
0 commit comments