@@ -17,6 +17,86 @@ environment in [VS Code](https://code.visualstudio.com/).
17
17
18
18
## Snippets List for JS/TS
19
19
20
+ ### Components
21
+
22
+ #### ` rfc⇥ `
23
+
24
+ Creates a React Functional Component
25
+
26
+ Only for languages: ` .tsx `
27
+
28
+ ``` tsx
29
+ type MyDynamicComponentNameProps = { … }
30
+
31
+ export const MyDynamicComponentName = ({ … }: MyDynamicComponentNameProps ): JSX .Element => {
32
+ return (
33
+ <div >$0</div >
34
+ )
35
+ }
36
+
37
+ export default MyDynamicComponentName
38
+ ```
39
+
40
+ #### ` getServerSideProps⇥ `
41
+
42
+ Adds the ` getServerSideProps ` function
43
+
44
+ Only for languages: ` .tsx `
45
+
46
+ ``` tsx
47
+ export const getServerSideProps: GetServerSideProps <…> = async (context ) => {
48
+ const data: … = {};
49
+
50
+ if (! data ) {
51
+ return {
52
+ notFound: true ,
53
+ }
54
+ }
55
+
56
+ return {
57
+ props: {
58
+ ... data ,
59
+ },
60
+ };
61
+ };
62
+ ```
63
+
64
+ #### ` getStaticPaths⇥ `
65
+
66
+ Adds the ` getStaticPaths ` function
67
+
68
+ Only for languages: ` .tsx `
69
+
70
+ ``` tsx
71
+ export const getStaticPaths: GetStaticPaths = async () => {
72
+ return {
73
+ paths: [
74
+ {
75
+ params: {},
76
+ },
77
+ ],
78
+ };
79
+ };
80
+ ```
81
+
82
+ #### ` getStaticProps⇥ `
83
+
84
+ Adds the ` getStaticProps ` function
85
+
86
+ Only for languages: ` .tsx `
87
+
88
+ ``` tsx
89
+ export const getStaticProps: GetStaticProps <…> = async () => {
90
+ const data: … = {};
91
+
92
+ return {
93
+ props: {
94
+ ... data ,
95
+ },
96
+ };
97
+ };
98
+ ```
99
+
20
100
### Common
21
101
22
102
| Trigger | Content | Only for languages |
@@ -73,26 +153,6 @@ environment in [VS Code](https://code.visualstudio.com/).
73
153
| ` useState⇥ ` | create ` useState ` hook |
74
154
| ` useTranslation⇥ ` | create ` useTranslation ` hook (part of [ react.i18next] ( https://react.i18next.com/ ) ) |
75
155
76
- ### React Components
77
-
78
- #### ` rfc⇥ `
79
-
80
- Creates a React Functional Component
81
-
82
- Only for languages: ` .tsx `
83
-
84
- ``` .tsx
85
- type MyDynamicComponentNameProps = { … }
86
-
87
- export const MyDynamicComponentName = ({ … }: MyDynamicComponentNameProps ): JSX .Element => {
88
- return (
89
- <div >$0</div >
90
- )
91
- }
92
-
93
- export default MyDynamicComponentName
94
- ```
95
-
96
156
## Snippets List for Markdown
97
157
98
158
| Trigger | Content |
0 commit comments