Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference b/w React Typescript , React JavaScript and React Native?

I have confusion about React JavaScript , React Typescript and React Native.

I just have idea that we use React Native for mobile applications and and React (Javascript,Typescript) for web applications.

Can someone exactly draw the difference between them ? Which parent library/framework those use ?

Like Angular can we make components,services in them(React JavaScript , React Typescript and React Native).

And when we simply say React what does it mean (Native , Typescript or Javascript) ?

like image 236
Wasim Avatar asked Jul 01 '20 13:07

Wasim


People also ask

What is the difference between TypeScript and React Native?

TypeScript is a language which extends JavaScript by adding type definitions, much like Flow. While React Native is built in Flow, it supports both TypeScript and Flow by default.

What is difference between React with JavaScript and React with TypeScript?

At the end of the day, the only difference between TypeScript and JavaScript React project is that its file extension ends with . tsx and the other ends with . js .

What is the difference between React and React Native and ReactJs?

React is known as ReactJs, which is a JavaScript library to build single-page web applications. Besides, React Native is a React JS-based framework to design mobile apps. Moreover, with reusable components, you can develop native mobile applications.

Which is better JavaScript or TypeScript in React Native?

With all these advantages and disadvantages, Typescript still provides great value to your project. You will save many hours of debugging time by using TypeScript. Therefore, you should definitely use TypeScript in your React Native Project.


2 Answers

React is a library/framework for building UIs. You construct various components that describe what you want the page to look like, and then react handles figuring out what changed and making updates to the page. If someone just says "react" without any other context, this is probably what they mean.

React Native uses the same core functionality as react, but once it has figured out the changes that need to be made, rather than update the dom (ie, the webpage), it updates native components for android or ios. React native thus lets you write native phone apps, using the syntax and tools that are familiar to react developers.

Javascript vs typescript is completely different axis. They can be used with react, but they are unrelated to react. Javascript is the main programming language used by webpages. Typescript is a superset of javascript, which lets you add type information to your code. This then lets you find bugs in your code quicker, because your IDE and build process can check the types to see if you've made mistakes.

like image 104
Nicholas Tower Avatar answered Oct 19 '22 06:10

Nicholas Tower


Before going into the difference between React JS and React TS, you have to understand how React TS projects, in fact any TS project, actually works.

TypeScript is not a language that runs natively on the web. The typings that you add to your codebase don't have any meaning on the browser. When you build your code, your TypeScript code gets transpiled to JavaScript. So if you look at the bundled code, you can't find any difference between React JS and React TS, they bundle the same JavaScript code.

With that out of the way, let's talk about React Native and React. React, on its own, is a framework to build applications declaratively with components. When people refer to React while building a web app, they often just say React but they should instead say React and React-DOM because React-DOM is the library that actually renders to the browser.

You can think of React as the foundations of the React ecosystem. React-DOM is the library that builds on React to render your applications on the web. React Native is the library that renders your application on mobile apps and even more (MacOS, Windows, Apple TV and so on are also possible compile targets for React Native). I suggest you read React Native documentation to learn more about how it does this. I've personally used the Expo Managed Workflow to develop cross-platform mobile apps.

The difference between doing React JS and React TS is the language you write. You write JavaScript or TypeScript, but at the end of the day the bundle is always JavaScript (Note: Deno is different, it natively runs TypeScript, check it out).

And the difference between writing Javascript and Typescript is only the developer experience. When you write Typescript, you get static type-checking and incredible autocompletion. I always write Typescript because it finds most mistakes I make before I get a chance to even run my code. The downside to this is that, when I use libraries that don't have typings, I have to deal with that on my own (either write typings myself or use something else).

like image 22
Mehmet Efe Akça Avatar answered Oct 19 '22 06:10

Mehmet Efe Akça