While trying to familiarize myself with Typescript in React, I started off with a simple functional component which will return an element. I ran into a problem: What is the return type for this functional component? Is it Element? After trying to figure it out, I ended up having to look it up in order to find out what it is. Here is the solution to this problem:

Javascript

import React from 'react';

const App = () => (
     
     <p>Hello World</p>
);

Typescript

import React, {ReactElement} from 'react';

const App: React.FC = (): ReactElement =>(
  <p>Hello World</p>
);