DEV Community

Rounit Ranjan Sinha
Rounit Ranjan Sinha

Posted on

Do browsers really understand JSX? What are transpilers?

Do browsers understand JSX?

Short Ans - NO

Long Ans - No, to render JSX in a web browser, it needs to be transpiled into regular JavaScript using a tool like Babel. The resulting JavaScript code can then be executed by the web browser.

So, What it is meant to be transpiled?
=> Transpiling is the process of converting source code written in one programming language into another programming language that has a similar level of abstraction.

But that's what a compiler do, so what's the difference?
=> Transpilers and compilers are both types of tools that convert code written in one programming language into another language, but there are some differences between them:
1)Output language: The main difference between a transpiler and a compiler is the output language. A compiler typically translates source code into machine code that can be directly executed by a computer, while a transpiler usually converts code into a higher-level programming language that needs to be further processed or executed in a runtime environment.

2)Level of abstraction: Compilers generally operate at a lower level of abstraction than transpilers.
(The level of abstraction refers to how much detail or complexity is present in a particular idea or concept.)
For example, let's consider the concept of a car. At a high level of abstraction, we might think of it as a vehicle that transports people or goods from one place to another. We're not concerned with the specific details of the car's mechanics, design, or history.
On the other hand, at a low level of abstraction, we might look at specific details of a car, such as its engine, transmission, wheels, and interior features. We're now dealing with more specific and detailed information.

3)Target audience: Compilers are usually intended for developers who are building low-level systems or performance-critical applications, while transpilers are more commonly used by web developers who want to write code in modern languages and still support older web browsers.

Top comments (0)