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
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).
59
59
60
60
```ts
61
61
typeProps= {
@@ -65,7 +65,7 @@ type Props = {
65
65
const FunctionComponent:React.FunctionComponent<Props> = ({ foo, children }:Props) => {
66
66
return <div>{foo} {children}</div>; // OK
67
67
};
68
-
// Error now, in future, deprecated
68
+
// Error now (children not support), in future, deprecated
69
69
const VoidFunctionComponent:React.VoidFunctionComponent<Props> = ({ foo, children }) => {
0 commit comments