Introduction to Babel
What is transpiler?
It is a tool which is used to convert source code into another source code which is of the same level. That is why it is also known as a source-to-source compiler. Both the codes are equivalent in nature, considering the fact that one works with the specific version of the browser and one doesn’t.
Note: It is also good to note that a compiler is totally different from a transpiler as the transpiler convert source code into another source code at the same abstraction level, whereas the compiler converts code into a lower level code generally. Like in Java, the source code is converted to byteCode which is lower level and not equivalent.
Why do we need Babel?
Before installing and making use of all the features of the Babel tool, let’s see a simple code of the latest standard version of ES2017 and see what happens to it when we pass it into babel engine.
Some of the above code is not supported in some browers, so after transpiling through Babel we will get:
In the next article we will learn how to install Babel and will also see more examples of it.
- ReactJS | Using Babel
- ReactJS | Introduction to JSX
- ReactJS | Calculator App ( Introduction )
- ReactJS | Refs
- ReactJS | Fragments
- ReactJS | Props - Set 1
- ReactJS | PropTypes
- ReactJS | Props - Set 2
- ReactJS | Components
- ReactJS | Virtual DOM
- ReactJS | Lists
- ReactJS | Keys
- ReactJS | Components - Set 2
- ReactJS | ReactDOM
- ReactJS | State vs props
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.