Check out example codes for "why use typescript with react". It will help you in understanding the concepts better.

Code Example 1

npm install --save typescript @types/node @types/react @types/react-dom @types/jest

Learn ReactJs, React Native from akashmittal.com