r/reactjs • u/dance2die • May 01 '22
Needs Help Beginner's Thread / Easy Questions (May 2022)
You can find previous Beginner's Threads in the wiki.
Ask about React or anything else in its ecosystem here.
Stuck making progress on your app, need a feedback?
There are no dumb questions. We are all beginner at something 🙂
Help us to help you better
Improve your chances of reply
- Add a minimal example with JSFiddle, CodeSandbox, or Stackblitz links
- Describe what you want it to do (is it an XY problem?)
- and things you've tried. (Don't just post big blocks of code!)
- Format code for legibility.
- Pay it forward by answering questions even if there is already an answer. Other perspectives can be helpful to beginners.
Also, there's no quicker way to learn than being wrong on the Internet.
New to React?
Check out the sub's sidebar! 👉
For rules and free resources~
Comment here for any ideas/suggestions to improve this thread
Thank you to all who post questions and those who answer them.
We're still a growing community and helping each other only strengthens it!
20
Upvotes
View all comments
Show parent comment
2
u/Beastrick Jun 01 '22
Typescript gets compiled to JS so you lose the type checking when you actually run the app at browser. Now if you for example test your application and fetch data from API and let's say the data is not exactly how you expected it to be while writing with Typescript, it takes some time before data is fetched or maybe database got some typing wrong for whatever reason. Each of these has happened to me while developing React and when I was not in charge of our Python backend or I used external API which we had no control over. You would not get notified from above things since type checks are gone at runtime. If you have PropTypes then you get notified if you are passing wrong data to components which might be more informative error than the error your component is likely to give. So for this reason I would use PropTypes with Typescript and since there are plugins to automate that then it is not much extra work to do so and might save you from couple of headaches as time goes. If there was no way to automate it then it might have not been worth the hassle but while Typescript and PropTypes do have some overlap, they are still different tools.