React TypeScript Tutorial – 2 – Getting Started
![*](https://i0.wp.com/allprowebdesigns.com/wp-content/uploads/2024/01/1704225604_maxresdefault.jpg?resize=840%2C430&ssl=1)
Video Title: React TypeScript Tutorial – 2 – Getting Started
All right in this video let’s get started with some code setup as you can see i have created a folder called react typescript and opened vs code inside that folder this folder is going to be our workspace for the rest of the series now to learn about typescript with react
We first need a react app that is configured specifically for typescript luckily for us create react app provides a typescript template we can use so in the terminal run the command npx create react app react hyphen typescript hyphen demo dash dash template space type script here react typescript demo is our project name
And we specify we want typescript to be configured by using the template option once the command completes you should have a folder called react typescript demo to run this application first navigate inside the project folder so cd into the project folder and now run the command yarn start or npm start
The command will open the browser on localhost port 3000 with your basic react typescript application up and running let’s head back to vs code as there is one important point to make note of if i expand the source folder we see an index.tsx file and an app.tsx file
Index.tsx is the entry point to our react app where we mount the app component onto the root dom node and app.esx contains our app component which is the root component unlike a regular create react app project though the file extension is dot tsx and this is your first learning from react typescript codebase
Components are defined in a dot tsx file and not a dot js or dot jsx file i stress this because when we begin writing react applications with typescript we fall back into the habit of creating a dot js file or a dot jsx file and the app simply breaks
We spend a good amount of time wondering what the problem is so make sure your files are dot tsx extension also to our surprise both these files contain nothing that looks like typescript code but if you hover on the app component vs code tells us that app component is a
Function which returns a jsx element and this is called type inference and you will learn that type inference comes in handy most of the time we are writing code we only have to intervene when typescript needs a little bit of help with that in mind i’m going to make
Small changes to ensure we are ready to learn some new things in the next video in app.tsx i’m going to remove the header content and also the unnecessary imports at the top next in the source folder i’m going to create another folder called components i’m going to leave it empty for now but
Before we start a video i might create a component behind the scenes which will help you focus on typescript aspects rather than plain react code which you might already know so for a lot of the videos we will start with a component already in place and just focus on making it work with
Typescript all right now that we have a react app configured with typescript in the next video let’s see how to work with some component props
-
Sale!
Wireless WIFI Repeater Extender Amplifier Booster 300Mbps
$29.99$14.99 Add to cartWireless WIFI Repeater Extender Amplifier Booster 300Mbps
Categories: Electronics, Wi-Fi Router, Wireless Wi-Fi Extender Tags: 300Mbps, 802.11N, Amplifier, Booster, Extender, mobile wi-fi booster, Remote, WIFI, Wireless, Wireless WIFI, Wireless WIFI Repeater, Wireless WIFI Repeater Extender, Wireless WIFI Repeater Extender Amplifier, Wireless WIFI Repeater Extender Amplifier Booster, Wireless WIFI Repeater Extender Amplifier Booster 300Mbps$29.99$14.99 -
Sale!
Full RGB Light Design Gaming Headset Headphones with Mic
$24.99$14.99 Add to cartFull RGB Light Design Gaming Headset Headphones with Mic
Categories: Electronics, Gaming, Gaming Headsets Tags: Design, Full, Full RGB Light Design Gaming Headset, Full RGB Light Design Gaming Headset Headphones, Full RGB Light Design Gaming Headset Headphones with Mic, Gamer, Gaming, Gaming Headset Headphones, gaming headset wireless, Headphone, Headphones, Headset, Light, Mic, Package, RGB$24.99$14.99 -
Sale!
Wireless BlueTooth Multi-Device Keyboard Mouse Combo
$39.99$19.99 Add to cartWireless BlueTooth Multi-Device Keyboard Mouse Combo
Categories: Electronics, Gaming, Gaming Keyboards, Keyboard Mouse Combos Tags: Combo, Keyboard, keyboard mouse combos, Mouse, MultiDevice, Set, WireKeyboard Mouse Combo, Wireless, Wireless BlueTooth Keyboard Mouse Combo, Wireless BlueTooth Keyboard Mouse Combos, Wireless BlueTooth Multi-Device Keyboard Mouse Combo, Wireless BlueTooth Multi-Device Keyboard Mouse Combos$39.99$19.99 -
Sale!
High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
$199.99$139.99 Add to cartHigh Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
Categories: Gaming, Gaming Chairs Tags: Adjustable, Chair, computer chairs, Desk, Executive, Gaming, Girl, Headrest, High, High Back Leather Executive Adjustable Swivel Gaming Chair, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar, High Back Leather Executive Adjustable Swivel Gaming Chairs, Leather, Lumbar, Office, Racing, Swivel$199.99$139.99 -
Sale!
Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
$29.99$19.99 Select optionsProfessional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
SKU: N/A Categories: Electronics, Gaming, Gaming Headsets Tags: Cancelling, Gaming, Gaming Headphones with Noise Cancelling Microphone, gaming headset, Headphones, Headset, LED, Light, Mic, Microphone, Noise, Professional, Professional LED Light Wired Gaming Headphones, Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone, Wired, Wired Gaming Headphones, Wired Gaming Headphones with Noise Cancelling Microphone$29.99$19.99 -
Sale!
Gaming Desk with LED Lights USB Power Outlets and Charging Ports
$349.99$249.99 Select optionsGaming Desk with LED Lights USB Power Outlets and Charging Ports
SKU: N/A Categories: Computer Desk, Gaming, Gaming Desk Tags: and Charging Ports, Charging, Desk, Desks, Gaming, gaming desk with led lights, Gaming Desks with LED Lights, Home, LED, Lights, Monitor, Office, Outlets, Port, Power, Room, Stand, USB, USB Power Outlets, White, Workstation$349.99$249.99 -
Sale!
Wired Mixed Backlit Anti-Ghosting Gaming Keyboard
$99.99$79.99 Add to cartWired Mixed Backlit Anti-Ghosting Gaming Keyboard
Categories: Electronics, Gaming, Gaming Keyboards Tags: Antighosting, Backlit, Blue, brown, Gaming, Gaming Keyboard, gaming keyboards, gaming keyboards and mouse, Keyboard, Laptop, Switch, Wired, Wired Mixed Backlit Anti-Ghosting Gaming Keyboard, Wired Mixed Backlit Anti-Ghosting Gaming Keyboards, Wired Mixed Backlit Gaming Keyboard$99.99$79.99 -
Sale!
Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
$119.99$59.99 Add to cartWireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
Categories: Electronics, Gaming, Gaming Headsets Tags: 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, ANC, Audio, Bluetooth, Cancellation, Ear, Earphone, gaming headset, Headphones, Headset, Hi-Res Over the Ear Headphones Headset, HiRes, Noise, Wireless, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Headphones, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headsets$119.99$59.99 -
Sale!
Wired Sports Gaming Headset Earbuds with Microphone
$19.99$9.99 Select optionsWired Sports Gaming Headset Earbuds with Microphone
SKU: N/A Categories: Gaming, Gaming Headsets Tags: Accessories, Earbud, Earphone, Earphones, Gaming, gaming headset with microphone, Headphones, Headset, IOS, Microphone, Sports, Wired, Wired Sports Gaming Headset Earbuds, Wired Sports Gaming Headset Earbuds with Microphone, Wired Sports Headset Earbuds$19.99$9.99 -
Sale!
150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
$49.99$29.99 Add to cart150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
Categories: Charging Stations, Electronics Tags: 150W, 150W Charging Station, 150W Universal Multi USB Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Stations, 150W Universal Multi USB MAX Charging Station, 16 Port MAX Charging Station, 3.5A, Charger, Charging, Fast, laptop charging stations, Max, Multi, Port, Stand, Station, Universal, USB$49.99$29.99
Use coupon code CodevolutionYoutube for 100% off lifetime discount to your subscription at https://www.taskade.com/billing
My favorite channel to learn from
yarn start = if this code doesn't work go for npm install -g yarn
excellent speaker for Indian 😀
what is the vs code theme do you use in this video? looks nice 🙂
thanks dear vishvas
The command: npx create-react-app react-typescript-demo –template typescript
create an application that has files with .js extensions and not .tsx
It give me this error: The react-scripts version you're using is not compatible with the –template option.
GoodJob!
One of the best tutors from India. Always explains complex terminologies in a very easy way. Hats off to you Sir.
is there any extension which tells us about types | events in ts ???? plx anyone
App bahut ache content create kiye ho or apka teaching way bhi attractive hai aisa kav na lagta ki bore ho gyen or maine react-adv next typescript apse sikha hun
Im having some trouble with my installation
1. In tsconfig.json there is "jsx" : "react-jsx" by default, which showing an error,
2. I just copied one jsx file content to a tsx file which i created and it does not complain anything about the props being used but when i try to use that component with missing props intentionally then its showing an error there which is expected
I did noticed that installed TS verson via npm is 4.4.4 but my editor is using global TS which is 3.8(doubting that might be the issue)
nice
Finally you have started I am waiting for this very long time 😀😀thanks a lot… 👍👍
I have learnt many languages by you.
Because u r the best technical teacher of the coding.
Happy teachers day to you
How to use hooks & redux with TS pleeeeeas
Please upload whole series as fast as you can
ty
We were waiting since long and wait is over finally. Thanks sir, Happy Teacher's Day
cant wait for next video 🙏🙏
Hey, can you motivate me by sharing your YouTube journey and earning. Though of starting a channel long back but not yet
Please Explain everything with Function component because class component is legacy now.
Finally I got what I'm waiting for. Thanks a lot and Happy Teacher's Day