Skip to main content

Creating project

using NPM to CRA new react-typescript app

npx create-react-app MY_APP --template typescript

using yarn to create new react-typescript app

yarn create react-app MY_APP --template typescript

create TS files based on JSX

MUST use .tsx for file with any JSX

use .ts files for no JSX - else TS will throw an error: Operator '<' cannot be applied to types 'boolean' and 'RegExp'.ts(2365)

References