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
Copy file name to clipboardExpand all lines: docs/basic/getting-started/basic-type-examples.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ Relevant for components that accept other React components as props.
88
88
```tsx
89
89
exportdeclareinterfaceAppProps {
90
90
children?:React.ReactNode; // best, accepts everything React can render
91
-
childrenElement:JSX.Element; // A single React element
91
+
childrenElement:React.JSX.Element; // A single React element
92
92
style?:React.CSSProperties; // to pass through style props
93
93
onChange?:React.FormEventHandler<HTMLInputElement>; // form events! the generic parameter is the type of event.target
94
94
// more info: https://react-typescript-cheatsheet.netlify.app/docs/advanced/patterns_by_usecase/#wrappingmirroring
@@ -124,16 +124,16 @@ This is because `ReactNode` includes `ReactFragment` which allowed type `{}` bef
124
124
</details>
125
125
126
126
<details>
127
-
<summary><b>JSX.Element vs React.ReactNode?</b></summary>
127
+
<summary><b>React.JSX.Element vs React.ReactNode?</b></summary>
128
128
129
-
Quote [@ferdaber](https://github.com/typescript-cheatsheets/react/issues/57): A more technical explanation is that a valid React node is not the same thing as what is returned by `React.createElement`. Regardless of what a component ends up rendering, `React.createElement` always returns an object, which is the `JSX.Element` interface, but `React.ReactNode` is the set of all possible return values of a component.
129
+
Quote [@ferdaber](https://github.com/typescript-cheatsheets/react/issues/57): A more technical explanation is that a valid React node is not the same thing as what is returned by `React.createElement`. Regardless of what a component ends up rendering, `React.createElement` always returns an object, which is the `React.JSX.Element` interface, but `React.ReactNode` is the set of all possible return values of a component.
130
130
131
-
-`JSX.Element` -> Return value of `React.createElement`
131
+
-`React.JSX.Element` -> Return value of `React.createElement`
132
132
-`React.ReactNode` -> Return value of a component
133
133
134
134
</details>
135
135
136
-
[More discussion: Where ReactNode does not overlap with JSX.Element](https://github.com/typescript-cheatsheets/react/issues/129)
136
+
[More discussion: Where ReactNode does not overlap with React.JSX.Element](https://github.com/typescript-cheatsheets/react/issues/129)
137
137
138
138
[Something to add? File an issue](https://github.com/typescript-cheatsheets/react/issues/new).
0 commit comments