How to use TypeScript with React... But should you?

preview_player
Показать описание

#js #react #typescript

🔗 Resources

🤓 Install the quiz app

🔥 Get more with Fireship PRO

Use code lORhwXd2 for 25% off your first payment.

My VS Code Theme

- Atom One Dark
- vscode-icons
- Fira Code Font
Рекомендации по теме
Комментарии
Автор

the ending was by far the best one i have seen 😂

rayanabid
Автор

Now I watched the full ad at the end cuz i thought the video was not finished. Genius move!

somedevstuff
Автор

now we need one of these great videos on TDD

julianhecker
Автор

Coming from a lot of C# and OOP, I started with TS and loved it way more than JS. Being able to ensure a variable type is extremely useful and more readable.

cerulityk
Автор

OMG. He is a mentalist. Today I started learning typescript with react.

nirmalmattmusic
Автор

After using TS with my react projects for the last 5 months, compared to the last 2 years with only JS, the difference is night and day. I can really never go back.

I used to be against TS because I thought it would be annoying, but it hasn't really. It's only helped me develop faster with more confidence of less bugs.

KevinVandyTech
Автор

Yes. Code overhead is a fact of life, writing more code is a reasonable trade-off for rock solid reliability through the development process. TS all the way!

SCREENLURKER
Автор

I read a really good article by Kent C Dodds on how to write a React Component with TypeScript, and he suggests to not use the `const Component:React.FC<Props> = (props)` (as seen 4:52) syntax but rather use the `const Component = (props: Props)` syntax. Basically, the first one has a children prop even if we didn't pass one, whereas the second one doesn't. (and a few other reasons as he lists)

It's a really good read, and interesting to hear his reasonings behind his opinion, I recommend it. YouTube will flag my comment if I post a direct link, but look up "How to write a React Component in TypeScript by Kent C Dodds" and you'll find it.

kylemckell
Автор

No bullshit...pure content..saves you a ton of hours jumping between blogs and tutorials.I would say you have an amazing talent at condensing content and put it in simple forms.

azzmounaim
Автор

Thanks! This was the perfect quick overview without having to dive into a 3-hour start-from-scratch tutorial.

BenjaminMillam
Автор

Great video as always, would love to see you talk about test driven development more in depth

tomasgoncalves
Автор

I started using typescript for the first time 6 months ago when I switched my job and started as a react developer. I've been coding js long enough and wasn't happy that they were using ts instead of vanilla. Oh man I was wrong. TypeScript is great and everything i wanted JS to have. Give it a try if you haven't.

alicanyenidogan
Автор

I began using TypeScript with React for the last few projects I been working on. At first a lot of frustration trying to get around all the type cryptic errors that kept popping up and adding to frustration and development time to the most simple tasks. Now with practice and expierence TypeScript has actually grown on me and all the code hinting I get from it is so nice to have. The cons are yes you have to write a ton more code especially as you create Interfaces for each component's props but as your app scales you will be happy you did. TypeScript definitely a must have for me now.

jacked
Автор

I just started learning TypeScript recently, and the first thing I did was implement various functional interfaces (Consumer, Predicate, Supplier, etc.) and the Optional class from Java. Because I love them. Could I have done that in pure JS? Sure, of course. But generics and strict typing make them *so much more useful* in TypeScript/Java.

IceMetalPunk
Автор

been using TS with React for about 4 years, for enterprise level applications I would say it's pretty much a necessity. I wouldn't really want to work without it unless I'm building a very small app

seandemps
Автор

I don't get too attached to tools (languages, frameworks, whatever) anymore but damn if TypeScript doesn't make me feel all warm and fuzzy inside. The only vanilla JS I write now is throwaway/scratchpad type stuff.

Aphova
Автор

I always thought typescript is somewhat confusing to learn. But after watching your video It seems easy. I know there's way more to it. But amazing none the less. Tnx 🥳

snakemanluffy
Автор

Bruh that "god damn precog" line got me so hard I'm still dying 😂

nosknut
Автор

Hmmm... What type should i use?
Few weeks later
*Spams any*

adityakolte
Автор

I took over a React project in JS almost a year ago. I shifted it towards TypeScript around April. I am so glad I did, it really is fantastic once you get over the initial hurdle of "why is my compiler complaining? I know my code!"

MrMudbill