Skip to content

Commit 42653cc

Browse files
committed
docs: add React.FC TypeScript example to examples.md
1 parent 911f928 commit 42653cc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/basic/examples.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,22 @@ sidebar_label: Examples
77
- [Create React App TypeScript Todo Example 2021](https://github.com/laststance/create-react-app-typescript-todo-example-2021)
88
- [Ben Awad's 14 hour Fullstack React/GraphQL/TypeScript Tutorial](https://www.youtube.com/watch?v=I6ypD7qv3Z8)
99
- [Cypress Realworld App](https://github.com/cypress-io/cypress-realworld-app)
10+
11+
---
12+
13+
### 🧠 Tip: Using TypeScript with React.FC
14+
15+
When defining a functional component with TypeScript, you can explicitly use the `React.FC` type for better prop validation and IntelliSense.
16+
17+
```tsx
18+
import React from "react";
19+
20+
type Props = {
21+
message: string;
22+
};
23+
24+
const Hello: React.FC<Props> = ({ message }) => {
25+
return <h1>{message}</h1>;
26+
};
27+
28+
export default Hello;

0 commit comments

Comments
 (0)