-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
321 lines (277 loc) · 10.1 KB
/
index.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
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>A look at React.js</title>
<meta name="description" content="A quick intro to react.js">
<meta name="author" content="Johan Bergens">
<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/css/reveal.min.css">
<!-- <link rel="stylesheet" href="reveal/css/theme/default-fix.css" id="theme"> -->
<link rel="stylesheet" href="reveal/css/theme/moon.css" id="theme">
<!-- For syntax highlighting in code -->
<link rel="stylesheet" href="reveal/lib/css/zenburn.css">
<link rel="stylesheet" href="pres.css">
<!-- 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/css/print/pdf.css' : 'reveal/css/print/paper.css';
// Disabling print version
//document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="reveal/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>
<h1>React.js and Flux</h1>
<h3>An introduction</h3>
<p>
<small>Created by Johan Bergens / <a href="http://tretton37.com/">tretton37.com</a></small>
</p>
</section>
<section>
<h2>About React</h2>
<div class="fragment">
<p class="">Javascript library for UI creation</p>
<p class="">The "V" in MVC</p>
<p>Created by Facebook to develop SPAs</p>
</div>
</section>
<section>
<h2>React goals</h2>
<p>
<blockquote class="" cite="https://facebook.github.io/react/docs/why-react.html">
"building large applications with data that changes over time"</blockquote>
<!-- blockquote class="fragment single" >"React is all about building reusable components. In fact,
with React the only thing you do is build components. Since they're so
encapsulated, components make code reuse, testing, and separation of
concerns easy."</blockquote -->
</p>
</section>
<section>
<h2>More ideas</h2>
<p>Use js</p>
<p>Single direction data flow</p>
<p>Make debugging easy</p>
</section>
<section>
<h2>Compared to Angular</h2>
<ul>
<li>Less things to learn</li>
<li>Faster for most things</li>
<li>Easier to combine with other js code</li>
<li>Less features, not a framework</li>
<li>Usable now (fall 2015) unlike Angular 2</li>
</ul>
</section>
<section>
<h1>Components</h1>
</section>
<section>
<h2>Components</h2>
<p>Building block of React</p>
<p>Can be nested</p>
<p>Just renders data and executes view logic</p>
<p>Other logic can be placed in js classes</p>
<p>Usually has "html" in the components (JSX)</p>
</section>
<section>
<h2>Some concepts for components</h2>
<p>Components owns state</p>
<p>Data is sent as properties</p>
<p>- propTypes can declare the properties</p>
<p>If state or properties are changed the component rewrites
itself</p>
<p>With Flux the main state is handled by a Store</p>
</section>
<section>
<h2>Components (2)</h2>
<img src="img/componentize.jpg" width="400" height="300" alt="Componentize all the things!">
</section>
<section>
<h2>React addons</h2>
<p>Extra things that adds missing functionality</p>
<ul>
<li>JSX to make code easier to read</li>
<li>Flux, Redux or Reflux for larger apps</li>
<li>ReactRouter for app navigation</li>
</ul>
<p>We'll get back to those</p>
</section>
<section>
<h2>Demo - Simple-1</h2>
<p>A component with state</p>
</section>
<section>
<h2>More about components</h2>
<p>Has some lifecycle functions</p>
<ul>
<li>- render()</li>
<li>- componentWillMount()</li>
<li>- componentDidMount()</li>
<li>- componentWillUnmount ()</li>
<li>- componentWillUpdate ()</li>
<li>- shouldComponentUpdate()</li>
</ul>
</section>
<section>
<h1>State and external data</h1>
</section>
<section>
<h2>Flux</h2>
<p>Pattern created by Facebook</p>
<p>Handles state and state changes for an application</p>
<p>Separate from the components but talks to them</p>
</section>
<section>
<h2>Description of Flux</h2>
<p>A Store handles top level logic and state</p>
<p>A Store responds to actions and changes its state</p>
<p>Components can call/create an action</p>
<p>Components can subcribe to a stores state changes</p>
</section>
<section>
<h2>Flux</h2>
<img src="img/flux-simple-f8.png">
<p><i>From Facebooks Flux web site</i></p>
</section>
<section>
<h2>Flux</h2>
<img src="img/flux-simple-f8-text.png">
<p><i>From Facebooks Flux web site</i></p>
</section>
<section>
<h2>Async</h2>
<p>Store methods are atomic</p>
<p>Async code usually lives in action creators</p>
<p>One action creator can create multiple actions</p>
<p>- findOrders, findOrdersDone, findOrderFailed</p>
</section>
<section>
<h2>Demo - Core Insats</h2>
<p>Made by <a href="http://www.tekis.se/">Tekis</a></p>
<p>Uses Alt.js stores</p>
<p>No universal js yet</p>
</section>
<section>
<h1>More about Flux</h1>
</section>
<section>
<h2>Many implementations of Flux</h2>
<p>Flux from Facebook - the original</p>
<p>Alt.js - easy to use</p>
<p>Reflux - even easier but different</p>
<p>Fluxxor - an alternative</p>
<p>Fluxible from Yahoo - another</p>
<p>And some more</p>
</section>
<section>
<h2>Flux alternatives</h2>
<p>Redux - single store, functional</p>
<p>Baobab - similar to Redux</p>
<p>GraphQL - complete query language and api. Need a server</p>
<p>Falcor from Netflix - not really flux but has state</p>
<p>Still more</p>
</section>
<section>
<h2>About Redux</h2>
<p>Functional store</p>
<p>A single global store</p>
<p>- nested states</p>
<p>Reducer functions updates the state</p>
<p>Filters can take a part of the state</p>
</section>
<section>
<h1>Some tips and tricks</h1>
</section>
<section>
<h2>Some tips and tricks</h2>
<p>Use container components</p>
<p>- separate view from logic</p>
<p>- reusable components</p>
<p>Higher order components adds features</p>
<p>With ES5 there is mixins to add features</p>
</section>
<section>
<h2>More tips and tricks</h2>
<p>React likes immutable data</p>
<p>Can be used for performance optimization</p>
<p>See shouldComponentUpdate()</p>
</section>
<section>
<h2>Other React features</h2>
<p>React can be used on the server</p>
<p>Universal js or isomorphic js</p>
<p>ReactNative as new way to build <em>native</em> iOS apps</p>
<p>Many other frameworks has taken ideas from React</p>
</section>
<section>
<h2>References</h2>
<p>Facebooks Github page</p>
<p><a href="https://facebook.github.io/react/">
https://facebook.github.io/react/
</a></p>
<p>Alt.js</p>
<p><a href="http://alt.js.org/">http://alt.js.org/</a></p>
<p>React router</p>
<p><a href="https://github.com/rackt/react-router">https://github.com/rackt/react-router</a></p>
</section>
<section>
<h2>Boilerplate projects</h2>
<p>Makes it easier to start with React</p>
<p><a href="https://github.com/gaearon/react-hot-boilerplate">
https://github.com/gaearon/react-hot-boilerplate
</a></p>
<p><a href="https://www.npmjs.com/package/hjs-webpack">
https://www.npmjs.com/package/hjs-webpack
</a></p>
<p><a href="https://github.com/gaearon/react-transform-boilerplate.git">
https://github.com/gaearon/react-transform-boilerplate.git
</a></p>
</section>
<section style="text-align: left;">
<h1>THE END</h1>
</section>
</div>
</div>
<script src="reveal/lib/js/head.min.js"></script>
<script src="reveal/js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
var revDependencies = [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
];
for (var i = 0; i < revDependencies.length; ++i) {
revDependencies[i].src = 'reveal/' + revDependencies[i].src;
}
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
// Parallax scrolling
// parallaxBackgroundImage: 'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg',
// parallaxBackgroundSize: '2100px 900px',
// Optional libraries used to extend on reveal.js
dependencies: revDependencies
});
</script>
</body>
</html>