descubre react
Javi Jimenez
Este libro está a la venta en http://leanpub.com/descubre-react
Esta versión se publicó en 2016-01-08
This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing
process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and
many iterations to get reader feedback, pivot until you have the right book andbuild traction once
you do.
© 2015 - 2016 Javi Jimenez
¡Twitea sobre el libro!
Por favor ayuda a Javi Jimenez hablando sobre el libro en Twitter!
El tweet sugerido para este libro es:
”Descubre ReactJS” es el nuevo libro en español de @soyjavi
El hashtag sugerido para este libro es #descubreReactJS.
Descubre lo que otra gente está diciendo sobre el libro haciendo click en este enlace parabuscar el
hashtag en Twitter:
https://twitter.com/search?q=#descubreReactJS
También por Javi Jimenez
CoffeeScript
Índice general
Agradecimientos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
i
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ii
Introducción . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . .
iv
Configurando tu entorno React . . . . . . . .
La manera rápida: JSFiddle . . . . . . . . .
La manera sencilla: En el documento HTML
La mejor manera: WebPack . . . . . . . . .
.
.
.
.
1
1
2
3
Tu primer React Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Etiquetas HTML y componentes . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . .
Atributos soportados . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
10
13
Propiedades . . . . . . . . . . . . . . . .
Propiedades por defecto . . . . . . . .
propTypes . . . . . . . . . . . . . . .
Transferencia shortcut de propiedades
Refs . . . . . . . . . . . . . . . . . . .
Children . . . . . . . . . . . . . . . .
className . . . . . .. . . . . . . . .
.
.
.
.
.
.
.
15
16
18
19
20
21
22
Estados . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Utilizando propiedades en el state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
27
Eventos Sintéticos . . . . . . . . . . . . .
SyntheticEvent . . . . . . . . . . . . .
Eventos soportados . . . . . . . . . .
Autobinding yDelegación de eventos
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
30
31
31
34
Ciclo de vida . . . . . . . . . . . . . . . . . . .
Construcción: componentWillMount . . . .
Construcción: componentDidMount . . . .
Actualización: componentWillReceiveProps
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
35
35
35
35
ÍNDICE GENERAL
Actualización: componentWillUpdate .
Actualización: shouldComponentUpdate
Actualización: componentDidUpdate . .
Destrucción: componentWillUnmount .
.
.
.
.
36
37
37
38
Hijos dinámicos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
Regístrate para leer el documento completo.