I am using tsx with React. My early days with React and not too much knowledge about Typescript.
@ types / react 16.0.25
respond 16.1.1
In my tsconfig.json, I have "noImplicitAny": false
When I write a functional component that returns a fragment:
function MyComponent() {
return [<div>1</div>, <div>2</div>];
}
Typescript complains:
TS2605: JSX element type 'Element[]' is not a constructor function for JSX elements.
Property 'render' is missing in type 'Element[]'.
If I define type: any, I miss the error
function MyComponent():any {
return [<div>1</div>, <div>2</div>];
}
Is this a problem from @ types / response or am I doing something wrong?
source
share