Migrating a React App to TypeScript, why do we need TypeScript ?

In order to learn a new skill, Typescript, I will try to migrate my existing React App project to Typescript, and write this blog post along ,maybe we get something at the end. If you are reading this, probably I did it.

TLDR; Let’s start.

Info about the project itself

It is my personal website in the very early stages, so what it does is displays a QR code that will lead the mobile user to a different route, but that’s not the point here, just migrate it to Typescript.

Your existing working JavaScript code is also TypeScript code.

Before going forward I recommend you reading the short TypeScript HandBook for JavaScript Developers.

A good practice won’t do any harm, will it ? So explore the TS Playground.

At this point, I must admit that I don’t see the reason for doing this and for using TypeScript at all.
Parameter ‘props’ implicitly has an ‘any’ type. Why should I break my code when everything is working just fine. I hope which was the initial idea too, to figure out why we actually need TypeScript ?!

Ok, let’s dive in and make some progress. First of all we rename all our files with .js extension to be .tsx (for example: index.js -> index.tsx)

STORY NOT COMPLETED YET….

--

--