Home  >  Article  >  Web Front-end  >  Can vue and react be run without babel?

Can vue and react be run without babel?

藏色散人
藏色散人Original
2021-01-26 09:31:331721browse

Vue and react cannot be run without babel, because the written code needs to be compiled with babel before the browser can recognize it; the compiled vue and react can be run without babel because their code has been processed by babel Converted.

Can vue and react be run without babel?

The operating environment of this tutorial: windows7 system, react17.0.1&&vue2.0 version, Dell G3 computer.

Recommended: "JS Basic Tutorial"

Can vue and react be run without babel?

You cannot run vue and react without babel during development, because the written code needs to be compiled with babel before the browser can recognize it; the compiled vue and react can run without babel because their code has been Converted through babel.

Babel is a JavaScript compiler, that is, when you use the latest JavaScript syntax, Babel converts it into browser-compatible JavaScript code through a syntax converter. This allows us to use the new syntax immediately without waiting for browser support.

For example:

// 下一代 JavaScript 语法
[1,2,3].map(n => n+1);
 
// babel转换为浏览器兼容的 JS 代码
[1,2,3].map(function(n){
    return n+1;
});

The above is the detailed content of Can vue and react be run without babel?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn