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快速上手开发
62
第
4
章
JSX
在本书前面的章节中,你已经学会了如何通过
render()
方法定义用户界面,以及如何调用
React.createElement()
方法和
React.DOM.*
函数家族(比如
React.DOM.span()
)。这种写法
有点麻烦,因为过多的函数调用会导致圆括号和花括号的闭合难以跟踪。接下来介绍一种
更便捷的写法:
JSX
。
JSX
是一项独立于
React
且完全可选的技术。如你所见,前面三章甚至没有使用过
JSX
。
当然,你可以选择不使用
JSX
。不过一旦尝试使用这项技术,你就很可能不会回到之前的
函数调用方法了。
JSX
的具体意义很难说清,但通常可以理解为
JavaScriptXML
或者
JavaScript
Syntax eXtension
(
JavaScript
语法扩展)的缩写。
JSX
开源项目的官网地址
是
http://facebook.github.io/jsx/
。
4.1
Hello JSX
首先回顾第
1
章的
Hello World
示例代码:
<script src="react/build/react.js"></script>
<script src="react/build/react-dom.js"></script>
<script>
ReactDOM.render(
React.DOM.h1(
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