DEV Community

Obioha victor
Obioha victor

Posted on

TypeScript vs React; which should I learn as a frontend developer.

React is a JavaScript library use to build reusable UI components for single page applications. It uses a jsx(JavaScript XML) syntax that allows you to write html-like code. Although jsx is not compulsory, it makes building applications with react easier.
Typescript is a superset of JavaScript, which means that typescript is JavaScript but with types. It is designed for large scale application and is transpiled to JavaScript.

Advantages of react

  1. Easy to learn and use: React is very beginner friendly and can be learnt with prior knowledge of html, CSS, and JavaScript.
  2. Mobile development: React is not only used for web development. With the help of a framework like react native you can build a mobile application with your knowledge of react which makes you more versatile as a developer.
  3. Component based architecture: React uses a component-based architecture that allows developers to build reusable UI components which makes development faster, less redundant and easier to maintain and scale.

Advantages of Typescript

  1. Compile-time error: Typescript enforces strict typing during compilation time which helps reveal potential errors and bugs, this happens before a typescript code is transpiled to JavaScript.
  2. Type inference: Typescript can infer the types of a variable from the value assigned to the variable thereby reducing development time and improving developer experience.
  3. Strong and static typing: Typescript allows you to specify the types of your variables, function parameters, and return values which help reduce errors and potential bugs.

Conclusion

Well, you might wonder which is the best for me to learn as frontend developer. I would say learn both- yes you heard me right. Typescript gives you extra superpowers as a JavaScript developer and react makes building user interface easier, I would advise you reap the benefits of both worlds. And if you need an internship to build all the necessary experience you need for your react journey, I recommend the HNG internship program -https://hng.tech/internship, or you can opt for the premium -https://hng.tech/premium to access exclusive opportunities like certificates, reference letters, and the latest job openings. It is a remote program, so you don't have to worry about commuting. Wish you the best on your coding journey.

Top comments (0)