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快速上手开发
Flux
|
167
虽然
schema
对象是按照原样传递的,但是数据看似并非如此。
<Whinepad>
组件接收到
initialData
属性后,会对数据进行某些修改再传递给
<Excel>
组件(传递的属性是
this.
state.data
而不是
this.props.initialData
)。这里会产生两个问题:如果新的数据不同于
原有数据,会发生什么?当提及最新的数据时,到底哪个组件拥有“单一数据源”?
在上一章的实现中,虽然顶层
<Whinepad>
组件确实包含了最新的数据,但这并没有明确为
什么
UI
组件(
React
是完全和
UI
相关的)应该掌握数据的来源。
接下来介绍如何把这项工作移交给
Store
进行处理。
8.3
Store
首先复制一份现有的代码:
$ cd ~/reactbook
$ cp -r whinepad2 whinepad3
$ cd whinepad3
$ npm run watch
接下来,创建一个新目录用于放置
Flux
模块(以便与
React
的
UI
组件区分开)。目前只需
创建
Store
和
Actions
两个模块:
$ mkdir js/source/flux
$ touch js/source/flux/CRUDStore.js
$ touch js/source/flux/CRUDActions.js
Flux
架构允许你创建多个
Store
(比如一个关于用户数据,另一个关于应用设置等),但目
前我们只关注单个
CRUD Store
的情况。这个
Store
全权负责处理一个记录列表;在这个例
子中,是关于酒类及其评价的记录。 ...
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