
by via Awwwards - Sites of the day
"Mr Branding" is a blog based on RSS for everything related to website branding and website design, it collects its posts from many sites in order to facilitate the updating to the latest technology.
To suggest any source, please contact me: Taha.baba@consultant.com
Big fan of the biography + image gallery adding personality to this One Page portfolio of product designer Karl Fernandes. It’s also real classy linking out to the typefaces used, as he’s done in the footer, well played Karl!
建築・インテリアの設計、監理業務、ランドスケープの設計、監理業務、家具デザイン、土地利用の計画等を行う兵庫県の設計事務所です。
CHAOS is an urban forecasting company for real estate investors and city developers.
Australia’s Most Innovative Mobile Apps, E-Commerce, Web Design & Development Digital Agency For Decade
When I first started learning TypeScript, one of the suggestions I often heard was, "convert one of your existing projects! It's the best way to learn!" Soon after, a friend from Twitter offered to do just that — show me how to migrate a React app to TypeScript.
The purpose of this article is to be that friend for you and help you migrate your own project to TypeScript. For context, I will be using pieces from a personal project which I migrated while going through this process myself.
To make this process feel less daunting, we'll break this down into steps so that you can execute the migration in individual chunks. I always find this helpful when taking on a large task. Here are all the steps we'll take to migrate our project:
tsconfig.jsonNOTE: the most important step in this whole process is number 9. Although we can only get there by working through them in sequential order.
First, we need to add TypeScript to our project. Assuming your React project was bootstrapped with create-react-app, we can follow the docs and run:
npm install --save typescript @types/node @types/react @types/react-dom @types/jest
or if you're using yarn:
yarn add typescript @types/node @types/react @types/react-dom @types/jest
Notice we haven't changed anything to TypeScript yet. If we run the command to start the project locally (yarn start in my case), nothing should be different. If that's the case, then great! We're ready for the next step.
tsconfig.jsonBefore we can take advantage of TypeScript, we need to configure this via the tsconfig.json. The simplest way for us to get started is to scaffold one using this command:
npx tsc --init
This gets us some basics.
We have not yet interacted with TypeScript. We have only taken the necessary actions to get things ready. Our next step is to migrate a file to TypeScript. With this, we can complete this step and move onto the next.
The beauty of TypeScript is that you can incrementally adopt it. We can start with a simple component for our first piece of this migration. For my project, I'm going to start with an SVG component that looks like this:
The post How to Migrate a React App to TypeScript appeared first on SitePoint.