Reactjs is consists of .js
files and JavaScript doesn't compile as it's an interpreted language. Then why Reactjs need to be compiled? I read that it uses the JSX compiler.
JSX includes markup syntax that isn't valid javascript. The JSX "compiler" translates the markup into vanilla javascript. You can see this yourself using the babel repl:
JSX in:
const Test = () => <div>test</div>
Javascript out:
"use strict";
var Test = function Test() {
return /*#__PURE__*/React.createElement("div", null, "test");
};
There's also the matter of bundling, resolving imports, adding polyfills, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With