-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
462 lines (445 loc) · 11 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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Redux</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/white.css">
<link rel="stylesheet" href="css/styles.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.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 ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section
data-background-image="/img/redux-logo.png"
data-background-size="90%"
>
</section>
<section>
<h1>
Repositorio del ejercicio
</h1>
<p>
https://github.com/abelta/poke-redux-2
</p>
</section>
<section>
<p class="fragment">
Librería
</p>
<p class="fragment">
Flujo
</p>
<p class="fragment">
Dan Abramov
</p>
</section>
<section data-background-image="/img/model-view-controller.jpg">
</section>
<section
class="section-colored"
data-background-image="/img/model-view-controller-dark.jpg"
>
<h1 class="red">
NO
</h1>
</section>
<section data-background-image="/img/broadcast-bg.jpg">
</section>
<section data-background-image="/img/broadcast-bg-dark.jpg">
<h1 class="white">
Pub-sub
</h1>
</section>
<section data-background-image="/img/shipping-containers.jpg">
</section>
<section data-background-image="/img/shipping-containers-dark.jpg">
<h1 class="white">
Contenedores
</h1>
<section class="white">
<p class="fragment">
Componentes React inteligentes
</p>
<p class="fragment">
Conectados al flujo de Redux
</p>
<p class="fragment">
Recibe propiedades inyectadas
</p>
</section>
<section>
<pre>
<code data-trim data-noescape>
import React from 'react';
import { connect } from 'react-redux';
import { actionExecuted } from 'actions';
const MyComponent = ({ injectedProp, injectedAction }) => (
// ...
);
const mapStateToProps = state => ({
injectedProp: state.prop,
});
const mapDispatchToProps = dispatch => ({
injectedAction: () => dispatch(actionExecuted()),
});
export default connect(mapStateToProps, mapDispatchToProps)(MyComponent);
</code>
</pre>
</section>
<section class="white">
<p class="fragment">
Reaccionan a cambios en el store
</p>
<p class="fragment">
Parte del store está inyectado en sus propiedades
</p>
<p class="fragment">
Pueden emitir una acción
</p>
</section>
</section>
<section data-background-image="/img/actions.png">
</section>
<section data-background-image="/img/actions-dark.png">
<h1 class="white">
Acciones
</h1>
<section class="white">
<p class="fragment">
Son mensajes muy sencillos
</p>
<p class="fragment">
Incluyen <b>type</b> y <b>payload</b>
</p>
<p class="fragment">
El componente emite con <b>dispatch</b>
</p>
</section>
<section>
<pre>
<code data-trim data-noescape>
const actionExecuted = ({ params }) => ({
type: 'ACTION_EXECUTED',
payload: { params },
});
export default actionExecuted;
</code>
</pre>
</section>
</section>
<section data-background-image="/img/reducers.jpg">
</section>
<section data-background-image="/img/reducers-dark.jpg">
<h1 class="white">
Reductores
</h1>
<section class="white">
<p class="fragment">
Son funciones
</p>
<p class="fragment">
Son un switch
</p>
<p class="fragment">
Reaccionan a una acción
</p>
</section>
<section>
<pre>
<code data-trim data-noescape>
const initState = {};
const myReducer = (state = initState, action) => {
switch (action.type) {
case 'MY_ACTION': {
const changes = {
// ...
};
return { ...state, ...changes };
}
default: return state;
}
};
export default myReducer;
</code>
</pre>
</section>
<section class="white">
<p class="fragment">
Hay varios reductores
</p>
<p class="fragment">
Se componen con la función de Redux <b>composeReducers</b>
</p>
<p class="fragment">
Cada reductor se encarga de modificar su parte del almacén
</p>
</section>
<section>
<pre>
<code data-trim data-noescape>
import { combineReducers } from 'redux';
import pokemon from './reducer1';
import pokemon from './reducer2';
const reducer = combineReducers({
reducer1,
reducer2,
});
export default reducer;
</code>
</pre>
</section>
</section>
<section data-background-image="/img/store.jpg">
</section>
<section data-background-image="/img/store-dark.jpg">
<h1 class="white">
Almacén de datos
</h1>
<section class="white">
<p class="fragment">
Viene definido por la estructura de los reductores
</p>
<p class="fragment">
Objetos de Javascript planos
</p>
<p class="fragment">
No puede modificarse directamente
</p>
</section>
</section>
<section data-background-image="/img/side-effects.jpg">
</section>
<section
class="white"
data-background-image="/img/side-effects-dark.jpg"
>
<h1 class="white">
Efectos secundarios
</h1>
<p>
No vienen contemplados en el flujo Redux
</p>
<p class="fragment">
Cookies
</p>
<p class="fragment">
Llamadas a servicios
</p>
<p class="fragment">
Operaciones en el tiempo
</p>
<p class="fragment">
Acceso a las APIs del navegador
</p>
</section>
<section>
<h1>
Redux Thunk
</h1>
<p class="fragment">
Es middleware
</p>
<p class="fragment">
Patrón thunk
</p>
</section>
<section>
<p>
Flujo Redux con Thunk
</p>
</section>
<section
data-background-image="/img/redux-thunk.png"
data-background-size="contain"
>
</section>
<section>
<p>
Flujo Redux con Sagas
</p>
</section>
<section
data-background-image="/img/redux-sagas.png"
data-background-size="contain"
>
</section>
<section
data-background-image="/img/redux-sagas-dark.png"
data-background-size="contain"
>
</section>
<section>
<h1>
Funciones generadoras
</h1>
<p class="fragment">
Permiten la ejecución de una función por pasos
</p>
</section>
<section>
<pre>
<code data-trim data-noescape>
function* generator(i) {
yield i;
yield i + 10;
}
var gen = generator(10);
console.log(gen.next().value); // => 10
console.log(gen.next().value); // => 20
</code>
</pre>
</section>
<section data-background-image="/img/sagas.jpg">
</section>
<section data-background-image="/img/sagas-dark.jpg">
<h1 class="white">
Redux Sagas
</h1>
<p class="fragment white">
Requiere el uso de funciones generadoras (ES6)
</p>
<p class="fragment white">
Las sagas escuchan las acciones igual que un reductor
</p>
<p class="fragment white">
Es una API más difícil de entender pero más flexible
</p>
<p class="fragment white">
No altera el flujo de una funcion sino que extiende el paradigma de Redux
</p>
<section>
<pre>
<code data-trim data-noescape>
import { call, put, spawn, takeLatest } from 'redux-saga/effects';
import * as types from 'actions/actionTypes';
import { actionSucceeded, actionFailed } from 'actions';
import { doSomethingAPI } from 'APICalls';
function* somethingRequested(action) {
const params = action.payload;
try {
const result = yield call(doSomethingAPI, params);
yield put(actionSucceeded({ result }));
} catch (error) {
yield put(actionFailed({ message: error.message }));
}
}
function* somethingRequestedSaga() {
yield takeLatest(types.SOMETHING_REQUESTED, somethingRequested);
}
function* mySaga() {
yield spawn(somethingRequestedSaga);
}
export default mySaga;
</code>
</pre>
</section>
</section>
<section>
<h1>
Proyección
</h1>
<section>
<h2>
React Native
<br />
<img
class="logo"
src="/img/react-native-logo.png"
/>
</h2>
</section>
<section>
<h2>
React VR
<br />
<img
class="logo"
src="/img/react-vr-logo.png"
/>
</h2>
</section>
<section>
<h2>
Server Side Rendering
</h2>
<p>
Next
<br />
<img
class="logo"
src="/img/nextjs-logo.jpg"
/>
</p>
</section>
<section>
<h2>
Serverless
</h2>
<p>
Firebase
<br />
<img
class="logo"
src="/img/firebase-logo.png"
/>
</p>
</section>
<section>
<h2>
Serverless
</h2>
<p>
Amazon Web Services
<br />
<img
class="logo"
src="/img/amazon-services-logo.jpg"
/>
</p>
</section>
</section>
<section
class="white"
data-background-image="/img/gracias-por-venir.jpg"
>
</section>
<section>
<h1>
Repositorio del ejercicio
</h1>
<p>
https://github.com/abelta/poke-redux-2
</p>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
width: "90%",
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); }, tabReplace: ' ' },
]
});
</script>
</body>
</html>