From 71ed6819ae545b9f42fb89015660ee23b291b095 Mon Sep 17 00:00:00 2001 From: Gihan Rangana Date: Tue, 7 Jan 2025 13:03:33 +0530 Subject: [PATCH 1/3] react functional component --- .../react-helpers/functional-component.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 snippets/typescript/react-helpers/functional-component.md diff --git a/snippets/typescript/react-helpers/functional-component.md b/snippets/typescript/react-helpers/functional-component.md new file mode 100644 index 00000000..f1270ea8 --- /dev/null +++ b/snippets/typescript/react-helpers/functional-component.md @@ -0,0 +1,24 @@ +--- +title: Fuctional Component +description: Functional component for React JS with props. +author: gihanrangana +tags: typescript,fuctional-component,react-props,reactjs +--- + +```tsx +import React from 'react'; + +interface ComponentNameProps { + // Define specific props here +} + +const ComponentName: React.FC = (props) => { + return ( +
+ {/* Add component content here */} +
+ ); +}; + +export default ComponentName; +``` \ No newline at end of file From c7788d01ec87e74f8345511148b50072276f88df Mon Sep 17 00:00:00 2001 From: Gihan Rangana Date: Tue, 7 Jan 2025 13:04:56 +0530 Subject: [PATCH 2/3] fix title --- snippets/typescript/react-helpers/functional-component.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/typescript/react-helpers/functional-component.md b/snippets/typescript/react-helpers/functional-component.md index f1270ea8..ac795a53 100644 --- a/snippets/typescript/react-helpers/functional-component.md +++ b/snippets/typescript/react-helpers/functional-component.md @@ -1,5 +1,5 @@ --- -title: Fuctional Component +title: Functional Component description: Functional component for React JS with props. author: gihanrangana tags: typescript,fuctional-component,react-props,reactjs From e83a86c500428b7051f74f6d97db9c08de4085f6 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 7 Jan 2025 07:35:16 +0000 Subject: [PATCH 3/3] Update consolidated snippets --- public/consolidated/typescript.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/public/consolidated/typescript.json b/public/consolidated/typescript.json index 1d3ece20..962adc01 100644 --- a/public/consolidated/typescript.json +++ b/public/consolidated/typescript.json @@ -15,5 +15,23 @@ "code": "type Exclusive = T | U extends Record\n ?\n | ({ [P in Exclude]?: never } & U)\n | ({ [P in Exclude]?: never } & T)\n : T | U;\n\n\n// Usage:\ntype A = { name: string; email?: string; provider?: string };\ntype B = { name: string; phone?: string; country?: string };\n\ntype EitherOr = Exclusive;\n\nconst w: EitherOr = { name: \"John\", email: \"j@d.c\" }; // ✅\nconst x: EitherOr = { name: \"John\", phone: \"+123 456\" }; // ✅\nconst y: EitherOr = { name: \"John\", email: \"\", phone: \"\" }; // ⛔️\nconst z: EitherOr = { name: \"John\", phne: \"\", provider: \"\" }; // ⛔️\n" } ] + }, + { + "name": "React Helpers", + "snippets": [ + { + "title": "Functional Component", + "description": "Functional component for React JS with props.", + "author": "gihanrangana", + "tags": [ + "typescript", + "fuctional-component", + "react-props", + "reactjs" + ], + "contributors": [], + "code": "import React from 'react';\n\ninterface ComponentNameProps {\n // Define specific props here\n}\n\nconst ComponentName: React.FC = (props) => {\n return (\n
\n {/* Add component content here */}\n
\n );\n};\n\nexport default ComponentName;\n" + } + ] } ] \ No newline at end of file

AltStyle によって変換されたページ (->オリジナル) /