Skip to content

Commit e581170

Browse files
authored
hide inside details
1 parent 6fb15d7 commit e581170

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,8 @@ const App = ({ message }: { message: string }) => <div>{message}</div>;
121121
Or you can use the provided generic type for function components:
122122

123123
```tsx
124-
// React.FC also works
125-
const App: React.FunctionComponent<{ message: string }> = ({ message }) => <div>{message}</div>;
126-
```
127-
128-
If you want to use the `function` keyword instead of an arrow function, you can use this syntax (using a function expression, instead of declaration):
129-
130-
```tsx
131-
const App: React.FunctionComponent<{ message: string }> = function App({ message }) {
132-
return <div{message}</div>;
133-
}
124+
// React.FunctionComponent also works
125+
const App: React.FC<{ message: string }> = ({ message }) => <div>{message}</div>;
134126
```
135127

136128
<details>
@@ -145,7 +137,13 @@ const Title: React.FunctionComponent<{ title: string }> = ({ children, title })
145137
);
146138
```
147139

148-
[Something to add? File an issue](https://github.com/sw-yx/react-typescript-cheatsheet/issues/new).
140+
If you want to use the `function` keyword instead of an arrow function, you can use this syntax (using a function expression, instead of declaration):
141+
142+
```tsx
143+
const App: React.FunctionComponent<{ message: string }> = function App({ message }) {
144+
return <div{message}</div>;
145+
}
146+
```
149147

150148
</details>
151149

0 commit comments

Comments
 (0)