Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
基于Redux的模块化设计
Search
JSConf China
October 20, 2019
Programming
0
27
基于Redux的模块化设计
Chinese version
For JSConf China 2019
By 林长青
JSConf China
October 20, 2019
Tweet
Share
More Decks by JSConf China
See All by JSConf China
Redux Based Modular Design
jsconfchina
0
17
Builing (Progressive) Web Apps
jsconfchina
0
20
Other Decks in Programming
See All in Programming
Performance for Conversion! 分散トレーシングでボトルネックを 特定せよ
inetand
0
3.4k
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
710
Swift Updates - Learn Languages 2025
koher
2
510
AWS発のAIエディタKiroを使ってみた
iriikeita
1
190
スケールする組織の実現に向けた インナーソース育成術 - ISGT2025
teamlab
PRO
2
170
そのAPI、誰のため? Androidライブラリ設計における利用者目線の実践テクニック
mkeeda
2
2.8k
テストコードはもう書かない:JetBrains AI Assistantに委ねる非同期処理のテスト自動設計・生成
makun
0
550
詳解!defer panic recover のしくみ / Understanding defer, panic, and recover
convto
0
250
さようなら Date。 ようこそTemporal! 3年間先行利用して得られた知見の共有
8beeeaaat
3
1.5k
JSONataを使ってみよう Step Functionsが楽しくなる実践テクニック #devio2025
dafujii
1
640
@Environment(\.keyPath)那么好我不允许你们不知道! / atEnvironment keyPath is so good and you should know it!
lovee
0
130
Processing Gem ベースの、2D レトロゲームエンジンの開発
tokujiros
2
130
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
74
5k
Speed Design
sergeychernyshev
32
1.1k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
For a Future-Friendly Web
brad_frost
180
9.9k
GraphQLとの向き合い方2022年版
quramy
49
14k
How to train your dragon (web standard)
notwaldorf
96
6.2k
Site-Speed That Sticks
csswizardry
10
820
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
139
34k
How to Think Like a Performance Engineer
csswizardry
26
1.9k
Transcript
基于Redux的模块化 设计 Michael Lin 林长青
2 | © 2019 RingCentral, Inc. All rights reserved. 动机
01 解决方案 03 Redux 缺点 02 Demo 04
3 | © 2019 RingCentral, Inc. All rights reserved. 如何构建基于Redux
大型应用?
4 | © 2019 RingCentral, Inc. All rights reserved. 构建大型应用
模块化 UI 组件 ?
5 | © 2019 RingCentral, Inc. All rights reserved. •
Redux 样板代码 Combine Reducers Middleware Connector Action Type
6 | © 2019 RingCentral, Inc. All rights reserved. 模块化
难点 核心业务逻辑与UI分离 模块化状态管理 优点 协作 分治 持续交付和产品迭代 更完整的自动化测试 模块化封装
7 | © 2019 RingCentral, Inc. All rights reserved. 为基于
Redux 的 中大型 React 应 用提供更好的模 块化设计模型。 动机和目标
8 | © 2019 RingCentral, Inc. All rights reserved. Redux
缺点
9 | © 2019 RingCentral, Inc. All rights reserved. Redux
缺点 松散, 难以模块化 模块化 繁琐的更新操作 不可变数据* 样板代码 不够简洁
10 | © 2019 RingCentral, Inc. All rights reserved. 解决方案
usm-redux
11 | © 2019 RingCentral, Inc. All rights reserved. Reducer
@state 装饰器
12 | © 2019 RingCentral, Inc. All rights reserved. Action
Type @action 装饰器
13 | © 2019 RingCentral, Inc. All rights reserved. Dispatch
调用Action函数
14 | © 2019 RingCentral, Inc. All rights reserved. 模块依赖
模块注入 可定制的 IoC
15 | © 2019 RingCentral, Inc. All rights reserved. 不可变数据更新
usm-redux 基于 immer 突变更新不可变数据的类库
16 | © 2019 RingCentral, Inc. All rights reserved. 好处
C 便利 更简单地更新不 可变数据 O OOP 简洁的模块化 与面向对象 O 可选 可选的生命周期 与可定制的IoC L 继承 拥抱Redux生态与 保持Redux原则
17 | © 2019 RingCentral, Inc. All rights reserved. https://github.com/unadlib/usm#quick-start-for-react
18 | © 2019 RingCentral, Inc. All rights reserved. Universal
State Module 更多信息 https://github.com/unadlib/usm
19 | © 2019 RingCentral, Inc. All rights reserved. THANKS.