How To Start React Using Typescript
This is how you can start React programming, it is cool framework for build front end web application, and not just for the web, React also can be use as Mobile User interface programming, but we will not cover that in this short tutorial. We are gonna start React programming for web using typescript.
Why typescript? it's because typescript supports static type programming, it is recommended to use typed language because your code will be more concise, structured and maintainable, and if you used advanced IDE, you will be given an error event before run time.
This is how you can start using React with typescript.
1. Make sure you have Yarn, if you don't, you can download it on this official website: https://yarnpkg.com/en/docs/install
2. If you are using Windows, you don't need any setup after yarn installation, yarn will do it for your. But, if you using Linux or Mac Os, you should add Yarn global package to your path using this command export PATH="$PATH:`yarn global bin`"
3. Now open terminal or command line, install create-react-app package, using this command:
yarn global add create-react-app
4. Now that you have create-react-app, you can now be easily create react app in the future. To create one, and using Typescript support, you type this command:
create-react-app yourprojectname --typescript
5. After it's all finish, move to your project directory using cd:
cd yourprojectname
6. If we, use ls on Linux and dir on Windows, now you have a react project structure
7. To start react for testing, you may use this command:
yarn start
That's so easy right? now it's up to you to codes your self using react Javascript framework.
Why typescript? it's because typescript supports static type programming, it is recommended to use typed language because your code will be more concise, structured and maintainable, and if you used advanced IDE, you will be given an error event before run time.
This is how you can start using React with typescript.
1. Make sure you have Yarn, if you don't, you can download it on this official website: https://yarnpkg.com/en/docs/install
2. If you are using Windows, you don't need any setup after yarn installation, yarn will do it for your. But, if you using Linux or Mac Os, you should add Yarn global package to your path using this command export PATH="$PATH:`yarn global bin`"
3. Now open terminal or command line, install create-react-app package, using this command:
yarn global add create-react-app
4. Now that you have create-react-app, you can now be easily create react app in the future. To create one, and using Typescript support, you type this command:
create-react-app yourprojectname --typescript
5. After it's all finish, move to your project directory using cd:
cd yourprojectname
6. If we, use ls on Linux and dir on Windows, now you have a react project structure
7. To start react for testing, you may use this command:
yarn start
That's so easy right? now it's up to you to codes your self using react Javascript framework.