1. 3
    Create stateless React components using TypeScript
    1m 37s

Create stateless React components using TypeScript

Share this video with your friends

Send Tweet

You can create a stateless React component in TypeScript as easily as creating a function.

But if you want to create high quality idiomatic React + TypeScript components we cover some improved patterns in this lesson.

Angshuman Agarwal
Angshuman Agarwal
~ 2 years ago

React.SFC is deprecated now. Use : https://github.com/basarat/react-typescript/blob/master/src/app/app.tsx

Sarmad ajaz
Sarmad ajaz
~ 10 months ago

Can we create a type like

type someProps = { compiler: string, framework: string }

const App: React.FC<someProps> = (props) => { return ( <div> <div>{props.compiler}</div> <div>{props.framework}</div> </div> ); }

Basarat Ali Syed
Basarat Ali Syedinstructor
~ 10 months ago

Yes Sarmad:

type SomeProps = { compiler: string, framework: string }

const App: React.FC<SomeProps> = (props) => { 
  return (
    <div>
      <div>{props.compiler}</div>
      <div>{props.framework}</div>
    </div>
  );
}