@@ -14,37 +14,86 @@ NextJS and React Snippets with TypeScript support as well!🚀
1414
1515### JavaScript
1616
17- 1 . ` rafce ` (React Functional Component)
17+ 1 . ` rimr ` (Import React)
18+
19+ ``` jsx
20+ import React from ' react' ;
21+ ```
22+
23+ 2. ` rimrd` (Import ReactDOM)
24+
25+ ` ` ` jsx
26+ import ReactDOM from 'react-dom';
27+ ` ` `
28+
29+ 3. ` rimrs` (Import React and useState)
30+
31+ ` ` ` jsx
32+ import React, { useState } from 'react';
33+ ` ` `
34+
35+ 4. ` rimrse` (Import React, useState and useEffect)
36+
37+ ` ` ` jsx
38+ import React, { useState, useEffect} from 'react';
39+ ` ` `
40+
41+ 5. ` rfce` (React functional component)
1842
1943 ` ` ` jsx
2044 const Component = () => {
2145 return <div></div>;
22- };
46+ }
2347 export default Component;
2448 ` ` `
2549
50+ 6. ` rue` (React useEffect)
51+
52+ ` ` ` jsx
53+ useEffect(() => {
54+
55+ }, []);
56+ ` ` `
57+
58+ 7. ` rus` (React useState)
59+
60+ ` ` ` jsx
61+ const [state, setState] = useState(initialValue);
62+ ` ` `
63+
64+ 8. ` ruc` (React useContext)
65+
66+ ` ` ` jsx
67+ const value = useContext(myContext);
68+ ` ` `
69+
70+ 9. ` rur` (React useRef)
71+
72+ ` ` ` jsx
73+ const refContainer = useRef(initialValue);
74+ ` ` `
75+
2676### TypeScript
2777
28- 2 . ` rafect ` (React Functional Component with Types )
78+ 1 . ` rfcet ` (React functional component Typescript )
2979
30- ` ` ` tsx
31- import { FC } from "react";
32- interface Props {}
33- const Component: FC<Props> = () => {
34- return <div></div>;
35- };
36- export default Component;
37- ` ` `
80+ ` ` ` tsx
81+ import React from "react";
82+
83+ interface Props {}
84+
85+ function Component({}: Props) {
86+ return <div></div>;
87+ }
88+
89+ export default Component;
90+ ` ` `
3891
3992## NextJS
4093
4194### JavaScript
4295
43- <<<<<< < HEAD
44- 1. ` nssr` (Get Server Side Props Next .js )
45- ====== =
46961. ` nssr` (Next .js Get Server Side Props Typescript)
47- >>>>>> > 5f7082e97c62b0d190ff1375a6a840db993a53c2
4897
4998 ` ` ` jsx
5099 export const getServerSideProps = async (context) => {
@@ -54,11 +103,7 @@ NextJS and React Snippets with TypeScript support as well!🚀
54103 };
55104 ` ` `
56105
57- <<<<<< < HEAD
58- 2. ` nssg` (Get Static Props Next .js )
59- ====== =
601062. ` nssg` (Next .js Get Static Props Typescript)
61- >>>>>> > 5f7082e97c62b0d190ff1375a6a840db993a53c2
62107
63108 ` ` ` jsx
64109 export const getStaticProps = async (context) => {
@@ -70,23 +115,15 @@ NextJS and React Snippets with TypeScript support as well!🚀
70115
71116### TypeScript
72117
73- <<<<<< < HEAD
74- 1. ` nssrt` (Get Server Side Props Next .js )
75- ====== =
761181. ` nssrt` (Next .js Get Server Side Props Typescript)
77- >>>>>> > 5f7082e97c62b0d190ff1375a6a840db993a53c2
78119
79120 ` ` ` tsx
80121 export const getServerSideProps: GetServerSideProps = async (context) => {
81122 return { props: {} };
82123 };
83124 ` ` `
84125
85- <<<<<< < HEAD
86- 2. ` nssgt` (Get Static Props Next .js )
87- ====== =
881262. ` nssgt` (Next .js Get Static Props Typescript)
89- >>>>>> > 5f7082e97c62b0d190ff1375a6a840db993a53c2
90127
91128 ` ` ` tsx
92129 export const getStaticProps: getStaticProps = async (context) => {
@@ -102,11 +139,7 @@ NextJS and React Snippets with TypeScript support as well!🚀
102139 };
103140 ` ` `
104141
105- <<<<<< < HEAD
106- 3 ) ` npaget` (NextPage component with NextPage type)
107- ====== =
108- 3 ) ` npt` (Next .js Page Typescript)
109- >>>>>> > 5f7082e97c62b0d190ff1375a6a840db993a53c2
142+ 4. ` npt` (Next .js Page Typescript)
110143
111144 ` ` ` tsx
112145 import type { NextPage } from "next";
@@ -116,11 +149,7 @@ NextJS and React Snippets with TypeScript support as well!🚀
116149 export default Page;
117150 ` ` `
118151
119- <<<<<< < HEAD
120- 4 ) ` nct` (Next JS Component with NextComponentType and Props)
121- ====== =
122- 4 ) ` nct` (Next .js Component Typescript)
123- >>>>>> > 5f7082e97c62b0d190ff1375a6a840db993a53c2
152+ 5. ` nct` (Next .js Component Typescript)
124153
125154 ` ` ` tsx
126155 import type { NextComponentType, NextPageContext } from "next";
0 commit comments