spatak
spatak

Reputation: 1389

'JSX' is not defined

This is my component:

enter image description here

And there are two errors TypeScript is showing

enter image description here

How can I tell this function that it's going to be passed the children property which will be the JSX element or an array of JSX elements

Upvotes: 1

Views: 4145

Answers (1)

Majid M.
Majid M.

Reputation: 4974

Try define your component as FunctionComponent from react. It has own children property:

import React, {FunctionComponent } from 'react';
type Props = ViewProps;
export const Component: FunctionComponent<Props> = (props) => {
  return <>
      {props.children}
  </>;
};

Upvotes: 2

Related Questions