8000 Update react.md · abhijit-hota/typescript-book@50c0e4d · GitHub
[go: up one dir, main page]

Skip to content

Commit 50c0e4d

Browse files
authored
Update react.md
1 parent fa29113 commit 50c0e4d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/jsx/react.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const MyComponent: React.FunctionComponent<Props> = (props) => {
5555

5656
### Void Function Components
5757

58-
As of [@types/react PR #46643](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/46643), you can use a new `React.VoidFunctionComponent` or `React.VFC` type if you wish to declare the accepted `children` explicitly. This is an interim solution until the next major version of the type defs (where VoidFunctionComponent will be deprecated and FunctionComponent will by default accept no children).
58+
As of [@types/react PR #46643](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/46643), you can use a new `React.VoidFunctionComponent` or `React.VFC` type if you wish to declare that a component does not take `children`. This is an interim solution until the next major version of the type defs (where VoidFunctionComponent will be deprecated and FunctionComponent will by default accept no children).
5959

6060
```ts
6161
type Props = {
@@ -65,7 +65,7 @@ type Props = {
6565
const FunctionComponent: React.FunctionComponent<Props> = ({ foo, children }: Props) => {
6666
return <div>{foo} {children}</div>; // OK
6767
};
68-
// Error now, in future, deprecated
68+
// Error now (children not support), in future, deprecated
6969
const VoidFunctionComponent: React.VoidFunctionComponent<Props> = ({ foo, children }) => {
7070
return <div>{foo}{children}</div>;
7171
};

0 commit comments

Comments
 (0)
0