Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ts react/functional component #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions public/consolidated/typescript.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,23 @@
"code": "type Exclusive<T, U = T> = T | U extends Record<string, unknown>\n ?\n | ({ [P in Exclude<keyof T, keyof U>]?: never } & U)\n | ({ [P in Exclude<keyof U, keyof T>]?: 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<A, B>;\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<ComponentNameProps> = (props) => {\n return (\n <div>\n {/* Add component content here */}\n </div>\n );\n};\n\nexport default ComponentName;\n"
}
]
}
]
24 changes: 24 additions & 0 deletions snippets/typescript/react-helpers/functional-component.md
View file Open in desktop
Copy link
Collaborator

@Mathys-Gasnier Mathys-Gasnier Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not qualify as a snippet under the guidelines of Quicksnip, this is an example.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: Functional 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<ComponentNameProps> = (props) => {
return (
<div>
{/* Add component content here */}
</div>
);
};

export default ComponentName;
```
Loading

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /