-
Notifications
You must be signed in to change notification settings - Fork 4
/
2017_jsunconf_mobx_redux.html
207 lines (176 loc) · 6.82 KB
/
2017_jsunconf_mobx_redux.html
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
<!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>React State Management with MobX and Redux</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="http://djcordhose.github.io/react-workshop/2017_jsunconf_mobx_redux.html">Slides: http://djcordhose.github.io/react-workshop/2017_jsunconf_mobx_redux.html</a></small></p>
</section>
<section>
<h2>Starting Point</h2>
<h3>Distributed State across components</h3>
<img src="ai/distributed-state.png" />
</section>
<section>
<h3>Motivation for State Management <strong>using a dedicated library</strong></h3>
<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>
<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: MobX</h1>
</section>
<section>
<img src="ai/mobx.png">
</section>
<section>
<h1>Demo</h1>
<h2>Looking at the code</h2>
</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>