Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
React快速上手开发
by
Stoyan Stefanov
March 2017
Intermediate to advanced
210 pages
5h 1m
Chinese
Posts & Telecom Press
Content preview from
React快速上手开发
64
|
第
4
章
以将其转换为浏览器可以正常解析的代码。
转译
JavaScript
正变得越来越普遍,因为程序员希望现在就能使用
ECMAScript6
(即
ECMAScript2015
)及以后的新特性,而无需等到浏览器支持这些特性。如果你已经设置了
一套构建流程(比如进行代码压缩,或者从
ECMAScript6
到
ECMAScript5
的转译操作),
那么只需要简单地添加
JSX
转换的步骤就可以了。假设你还不了解构建,接下来我们会简
单介绍一些客户端构建的流程。
4.3
Babel
Babel
(原名
6to5
)是一个开源的转译工具,支持转译最新的
JavaScript
特性,也支持转
译
JSX
。它是你使用
JSX
的前提。在下一章中,你将了解如何设置一个用于生产环境的构
建流程,让你可以把
React
应用发布到生产环境。在本章中,我们只对
Babel
作简要介绍,
并在客户端完成转译操作。
强制性警告:客户端转换仅用作原型展示、教育或探索目的。出于性能考
虑,请勿在实际应用中使用该方式进行代码转换。
要在浏览器中(即客户端)进行转换,你需要用到
browser.js
文件。
Babel
从版本
6
开始就
不再提供这个文件了,但你依然可以从旧版本中找到它:
$ mkdir ~/reactbook/babel
$ cd ~/reactbook/babel
$ curl https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.js >
browser.js
在
0.14
版本之前 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
JSON實務手冊
Tom Marrs
C++语言导学(原书第2版)
本贾尼 斯特劳斯特鲁普
React学习手册
Alex Banks, Eve Porcello
数据压缩入门
Colt McAnlis, Aleks Haecky
Publisher Resources
ISBN: 9787115447739