You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -113,7 +113,7 @@ Please PR or [File an issue](https://github.com/sw-yx/react-typescript-cheatshee
113
113
114
114
# Section 2: Getting Started
115
115
116
-
## Stateless Functional Components
116
+
## Function Components
117
117
118
118
*Contributed by: [@jasanst](https://github.com/sw-yx/react-typescript-cheatsheet/pull/9) and [@tpetrina](https://github.com/sw-yx/react-typescript-cheatsheet/pull/21)*
119
119
@@ -123,20 +123,20 @@ You can specify the type of props as you destructure them:
The former pattern is shorter, so why would people use `React.SFC` at all? If you need to use `children` property inside the function body, in the former case it has to be added explicitly. `SFC<T>` already includes the correctly typed `children` property which then doesn't have to become part of your type.
136
+
The former pattern is shorter, so why would people use `React.FunctionComponent` at all? If you need to use `children` property inside the function body, in the former case it has to be added explicitly. `FunctionComponent<T>` already includes the correctly typed `children` property which then doesn't have to become part of your type.
Within TypeScript, `React.Component` is a generic type (aka `React.Component<PropType, StateType>`), so you actually want to provide it with prop and (optionally) state types:
151
151
@@ -280,7 +280,7 @@ Instead of defining prop types *inline*, you can declare them separately (useful
0 commit comments