-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2017_jsunconf.html
More file actions
266 lines (226 loc) · 9.07 KB
/
Copy path2017_jsunconf.html
File metadata and controls
266 lines (226 loc) · 9.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jsunconf 2017</title>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="reveal.js/css/reveal.css">
<!--<link rel="stylesheet" href="reveal.js/css/theme/white.css" id="theme">-->
<!--<link rel="stylesheet" href="reveal.js/css/theme/black.css" id="theme">-->
<!--<link rel="stylesheet" href="reveal.js/css/theme/night.css" id="theme">-->
<link rel="stylesheet" href="reveal.js/css/theme/simple.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="reveal.js/lib/css/zenburn.css">
<style>
/*pre code {*/
/*display: block;*/
/*padding: 0.5em;*/
/*background: #FFFFFF !important;*/
/*color: #000000 !important;*/
/*}*/
.right-img {
margin-left: 10px !important;
float: right;
height: 500px;
}
.todo:before {
content: 'TODO: ';
}
.todo {
color: red !important;
}
code span.line-number {
color: lightcoral;
}
.reveal pre code {
max-height: 1000px !important;
}
img {
border: 0 !important;
box-shadow:0 0 0 0 !important;
}
</style>
<!-- Printing and PDF exports -->
<script>
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match(/print-pdf/gi) ? 'reveal.js/css/print/pdf.css' : 'reveal.js/css/print/paper.css';
document.getElementsByTagName('head')[0].appendChild(link);
</script>
<!--[if lt IE 9]>
<script src="reveal.js/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h2>Discussion: How to handle State in React Applications?</h2>
<p>
<small><a href="http://nilshartmann.net">Nils Hartmann</a> / <a href="http://twitter.com/nilshartmann">@nilshartmann</a>
</small>
</p>
<p>
<small><a href="http://zeigermann.eu">Oliver Zeigermann</a> / <a href="http://twitter.com/djcordhose">@DJCordhose</a>
</small>
</p>
<p><small><a href="https://bit.ly/jsunconf-react-state">Slides: https://bit.ly/jsunconf-react-state</a></small></p>
</section>
<section>
<h2>Distributed State across components</h2>
<img src="ai/distributed-state.png" />
</section>
<section>
<h2>Motivation for State Management</h2>
<p class="fragment">State distributed over many components can make applications hard to understand and debug</p>
<p class="fragment">Often more than one component depends on a certain part of state -
especially hard to do when components are not even in the same hierarchy </p>
</section>
<section>
<h2>Render Cycle in Pure React</h2>
<img src="images/redux-01-react-cycle-no-redux.png" style="border:0;box-shadow:0 0 0 0"/>
</section>
<section>
<h2>Unidirectional data flow</h2>
<img src="ai/react-unidirectional-data-flow.png" style="border:0;box-shadow:0 0 0 0"/>
<p>Base for most React-based architecture patterns</p>
</section>
<section>
<h1>Option 0</h1>
<h2>Smart and Dumb Components</h2>
<p>Common Architectural Pattern</p>
</section>
<!--<section>-->
<!--<h3>Smart Components</h3>-->
<!--<ul>-->
<!--<li>aka Container Components aka Containers</li>-->
<!--<li>manage a selection of the current application state (or are connected to state management)-->
<!--<li>pass down state to their children as properties-->
<!--<li>have UI logic they can call or pass down to their children as properties-->
<!--<li>might be mapped to a specific URL-->
<!--</ul>-->
<!--</section>-->
<!--<section>-->
<!--<h3>Dumb Components</h3>-->
<!--<ul>-->
<!--<li>aka Container Components aka Containers</li>-->
<!--<li>do not manage state (and are not connected to state management)-->
<!--<li>typically only contain other Dumb Components (there are-->
<!--<a target="_blank" href="https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0#.z8xy5zvhs">-->
<!--exceptions to this rule</a>)-->
<!--<li>have no knowledge of their parent-->
<!--<li>can hold and manage temporary UI state (like expanded or open)-->
<!--</ul>-->
<!--</section>-->
<section>
<!--<h3>Communication</h3>-->
<img src="images/smart-dumb-w-label.png">
</section>
<section>
<h2>Motivation for State Management <strong>using a dedicated library</strong></h2>
<p class="fragment">State management and handlers are extracted from React components</p>
<p class="fragment">Better separation of concerns</p>
</section>
<section>
<h1>Option 1: Redux</h1>
</section>
<section>
<h2>Render Cycle in Pure React</h2>
<img src="images/redux-01-react-cycle-no-redux.png" style="border:0;box-shadow:0 0 0 0"/>
</section>
<section>
<h2>Redux Extracts Responsibilities</h2>
<img src="images/redux-02-extracting-responsibility.png" style="border:0;box-shadow:0 0 0 0"/>
</section>
<section>
<h2>Resulting Redux Architecture</h2>
<img src="images/redux-03-resulting-redux-architecture.png" style="border:0;box-shadow:0 0 0 0"/>
</section>
<section>
<h1>Option 2: Flux</h1>
</section>
<section>
<img src="ai/flux.png">
</section>
<section>
<h1>Option 3: MobX</h1>
</section>
<section>
<img src="ai/mobx.png">
</section>
<section>
<h2><strong>We need your input</strong></h2>
<h3>What are alternatives?</h3>
<h3>Other ideas?</h3>
<h3>Is an Event-Bus evil?</h3>
</section>
<section>
<h2>Resources</h2>
<ul>
<li><a href="https://dannyherran.com/2017/03/react-redux-mobx-takeaways" target="_blank">https://dannyherran.com/2017/03/react-redux-mobx-takeaways</a></li>
</ul>
</section>
</div>
</div>
<script src="reveal.js/lib/js/head.min.js"></script>
<script src="reveal.js/js/reveal.js"></script>
<script src="lib/jquery-2.2.4.js"></script>
<script>
Reveal.addEventListener( 'ready', function( event ) {
if (window.location.hostname.indexOf('localhost') !== -1) {
// only applies to presentation version
Reveal.configure({ controls: false });
} else {
// only applies to public version
$('.fragment').removeClass('fragment');
}
// applies to all versions
$('code').addClass('line-numbers');
} );
</script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{
src: 'reveal.js/lib/js/classList.js', condition: function () {
return !document.body.classList;
}
},
{
src: 'reveal.js/plugin/markdown/marked.js', condition: function () {
return !!document.querySelector('[data-markdown]');
}
},
{
src: 'reveal.js/plugin/markdown/markdown.js', condition: function () {
return !!document.querySelector('[data-markdown]');
}
},
{
src: 'reveal.js/plugin/highlight/highlight.js', async: true, condition: function () {
return !!document.querySelector('pre code');
}, callback: function () {
hljs.initHighlightingOnLoad();
}
},
{src: 'reveal.js/plugin/zoom-js/zoom.js', async: true},
{src: 'reveal.js/plugin/notes/notes.js', async: true},
{src: 'lib/js/line-numbers.js'}
]
});
</script>
</body>
</html>