What is Babel and how can you use it?

What is Babel and how can you use it?

ยท

1 min read

Babel is a javascript compiler.

It is able to take next generation javascript like: ES6/ES7/ES8 and compiles it to a version of javascript that every browser can understand. This includes converting JSX to plain old javascript code.

Babel JS Compiler

If we head over to the section "try it out", we get two white windows where we can compare side by side our new generation JSX code to the converted old version of javascript code that can be read by every browser even good old internet explorer ๐Ÿ˜œ. babel-try-out.png

  • write this line of code in the left section of "try it out"
              <h1>React World </h1>,
              dest
              );
          </script>
    
  • the left section has the modern JSX code and the right section is the old javascript code. code.png

If you're wondering as to what exactly is JSX?

  • JSX stands for JavaScript XML. JSX allows us to write HTML in React. JSX makes it easier to write and add HTML in React.
ย