Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

React JS and why it's awesome

98 215 vues

Publié le

Introduction to React JS library and some of the fundamentals that set it apart from other choices

Publié dans : Logiciels
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • ACCESS that WEBSITE Over for All Ebooks (Unlimited) ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... DOWNLOAD FULL EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M }
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • If you want to download or read this book, copy link or url below in the New tab ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } .........................................................................................................................
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • If you want to download or read this book, Copy link or url below in the New tab ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... .........................................................................................................................
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici

React JS and why it's awesome

  1. 1. React and why it’s awesome Andrew Hull @aghull normative.com
  2. 2. React First Impressions
  3. 3. React First Impressions
  4. 4. React First Impressions WTF?!
  5. 5. “Reaction” to React
  6. 6. “Reaction” to React “Ugly.”
  7. 7. “Reaction” to React “Ugly.” “Separation of concerns!!”
  8. 8. “Reaction” to React “Ugly.” “Separation of concerns!!” “React is a templating language.”
  9. 9. “Reaction” to React
  10. 10. “Reaction” to React • Don’t sweat it
  11. 11. “Reaction” to React • Don’t sweat it • JSX
  12. 12. “Reaction” to React • Don’t sweat it • JSX • It’s actually just Javascript
  13. 13. “Reaction” to React • Don’t sweat it • JSX • It’s actually just Javascript • It’s not a templating language
  14. 14. “Reaction” to React • Don’t sweat it • JSX • It’s actually just Javascript • It’s not a templating language • If you don’t like it, you don’t hafta
  15. 15. React Second Impressions
  16. 16. React Second Impressions • Oh! There’s 2-way data-binding, like Angular!
  17. 17. React Second Impressions • Oh! There’s 2-way data-binding, like Angular! • Oh! It can work with Backbone. How I do?
  18. 18. React Second Impressions • Oh! There’s 2-way data-binding, like Angular! • Oh! It can work with Backbone. How I do? • Oh! It can do animations and SVG!
  19. 19. React Second Impressions • Oh! There’s 2-way data-binding, like Angular! • Oh! It can work with Backbone. How I do? • Oh! It can do animations and SVG! Wait. Let’s back up.
  20. 20. Some Fundamentals
  21. 21. #1 Everything is a Component
  22. 22. React has no…
  23. 23. React has no… … controllers
  24. 24. React has no… … controllers … directives
  25. 25. React has no… … controllers … directives … templates
  26. 26. React has no… … controllers … directives … templates … global event listeners
  27. 27. React has no… … controllers … directives … templates … global event listeners … models
  28. 28. React has no… … controllers … directives … templates … global event listeners … models … no view models
  29. 29. React has no… … controllers … directives … templates … global event listeners … models … no view models Just
  30. 30. React has no… … controllers … directives … templates … global event listeners … models … no view models Just Components
  31. 31. “Separation of concerns!!”
  32. 32. “Se“pDaora ytoioun e ovef nc oMnVcCer?n”s!!”
  33. 33. What if we “separate” another way?
  34. 34. What if we “separate” another way? CartComponent
  35. 35. What if we “separate” another way? CartComponent CartListComponent
  36. 36. What if we “separate” another way? CartComponent CartListComponent CartItemComponent
  37. 37. What if we “separate” another way? CartComponent CartListComponent CartItemComponent ButtonComponent
  38. 38. Separation of Concerns Components
  39. 39. Separation of Concerns Components •composable
  40. 40. Separation of Concerns Components •composable •reusable
  41. 41. Separation of Concerns Components •composable •reusable •maintainable
  42. 42. Separation of Concerns Components •composable •reusable •maintainable •testable
  43. 43. Separation of Concerns Components •composable •reusable •maintainable •testable *If* Components are truly self-contained
  44. 44. #2 Single Source of Truth
  45. 45. Traditional data flows
  46. 46. Traditional data flows No framework: Any component can communicate with any other component
  47. 47. Traditional data flows No framework: Any component can communicate with any other component Backbone: Pub-sub item.on('change:name', function() {…
  48. 48. Traditional data flows No framework: Any component can communicate with any other component Backbone: Pub-sub item.on('change:name', function() {… Angular: 2-way data binding and $digest loop $scope.name = …
  49. 49. Traditional data flows No framework: Any component can communicate with any other component Backbone: Pub-sub item.on('change:name', function() {… Angular: 2-way data binding and $digest loop $scope.name = … React: 1-way data flow
  50. 50. Data handed from parent to child check. props.
  51. 51. Props accessed on this.props
  52. 52. Props accessed on this.props props.
  53. 53. Props accessed on this.props props.
  54. 54. Props accessed on this.props props. props.
  55. 55. Props accessed on this.props props. props.
  56. 56. Props are immutable
  57. 57. Props are immutable props.
  58. 58. Props are immutable props.
  59. 59. Props are immutable props. Don’t touch my stuff!
  60. 60. State is mutable props.
  61. 61. State is mutable props.
  62. 62. State is mutable props.
  63. 63. State is mutable props. Whatever you say, dude.
  64. 64. State can become props
  65. 65. State can become props props.
  66. 66. State can become props props.
  67. 67. State can become props props. props.
  68. 68. State can become props props. props.
  69. 69. Data only flows one way
  70. 70. Data only flows one way Sure, sounds good…
  71. 71. Data only flows one way Sure, sounds good… (5 minutes later) Wait!
  72. 72. Data only flows one way Sure, sounds good… (5 minutes later) Wait! That’s not how the real world works!
  73. 73. Data flows up? CartComponent CartListComponent CartItemComponent <input>
  74. 74. Data flows down with handlers CartComponent! ! <CartListComponent! list={this.state.list}! onChange={this.handleChange}/>
  75. 75. Data flows down with handlers CartComponent! ! <CartListComponent! list={this.state.list}! onChange={this.handleChange}/> CartListComponent! ! this.props.list.map(function(item) {! <CartItemComponent item={item}! onChange={this.props.onChange}/>! })
  76. 76. Data flows down with handlers CartComponent! ! <CartListComponent! list={this.state.list}! onChange={this.handleChange}/> CartListComponent! ! this.props.list.map(function(item) {! <CartItemComponent item={item}! onChange={this.props.onChange}/>! }) CartItemComponent! ! changeQty: function() {! … does stuff! this.props.onChange();! }!
  77. 77. Data flows down with handlers CartComponent! ! <CartListComponent! list={this.state.list}! onChange={this.handleChange}/> CartListComponent! ! this.props.list.map(function(item) {! <CartItemComponent item={item}! onChange={this.props.onChange}/>! }) CartItemComponent! ! changeQty: function() {! … does stuff! this.props.onChange();! }! <input value={this.props.item.qty} onChange={this.changeQty}>
  78. 78. Data flows down with handlers CartComponent! ! <CartListComponent! list={this.state.list}! onChange={this.handleChange}/> CartListComponent! ! this.props.list.map(function(item) {! <CartItemComponent item={item}! onChange={this.props.onChange}/>! }) CartItemComponent! ! changeQty: function() {! … does stuff! this.props.onChange();! }! <input value={this.props.item.qty} onChange={this.changeQty}>
  79. 79. Data flows down with handlers CartComponent! ! <CartListComponent! list={this.state.list}! onChange={this.handleChange}/> CartListComponent! ! this.props.list.map(function(item) {! <CartItemComponent item={item}! onChange={this.props.onChange}/>! }) CartItemComponent! ! changeQty: function() {! … does stuff! this.props.onChange();! }! <input value={this.props.item.qty} onChange={this.changeQty}>
  80. 80. Data flows down with handlers CartComponent! ! <CartListComponent! list={this.state.list}! onChange={this.handleChange}/> CartListComponent! ! this.props.list.map(function(item) {! <CartItemComponent item={item}! onChange={this.props.onChange}/>! }) CartItemComponent! ! changeQty: function() {! … does stuff! this.props.onChange();! }! <input value={this.props.item.qty} onChange={this.changeQty}>
  81. 81. Data flows down with handlers CartComponent! ! <CartListComponent! list={this.state.list}! onChange={this.handleChange}/> CartListComponent! ! this.props.list.map(function(item) {! <CartItemComponent item={item}! onChange={this.props.onChange}/>! }) CartItemComponent! ! changeQty: function() {! … does stuff! this.props.onChange();! }! <input value={this.props.item.qty} onChange={this.changeQty}>
  82. 82. Events flow up, data flows down
  83. 83. Events flow up, data flows down Does this sound familiar?
  84. 84. Events flow up, data flows down Does this sound familiar? Just like the DOM.
  85. 85. #3 Virtual DOM
  86. 86. What’s worse than having state in two places at once?
  87. 87. What’s worse than having state in two places at once? Having state in the DOM.
  88. 88. Touching the DOM is evil
  89. 89. Touching the DOM is evil • It’s inconsistent
  90. 90. Touching the DOM is evil • It’s inconsistent • It’s hard to test
  91. 91. Touching the DOM is evil • It’s inconsistent • It’s hard to test • It’s brittle
  92. 92. Touching the DOM is evil • It’s inconsistent • It’s hard to test • It’s brittle • It’s EXPENSIVE!
  93. 93. Back to JSX
  94. 94. JSX Compiled
  95. 95. It’s just Javascript
  96. 96. It’s just Javascript
  97. 97. Why learn yet another template language?
  98. 98. What’s actually happening in render() ?
  99. 99. What’s actually happening in render() ? What does p() return?
  100. 100. What’s actually happening in render() ? What does p() return? When do I call render()
  101. 101. Virtual DOM
  102. 102. Virtual DOM • It’s a pure Javascript, in-memory representation of the DOM
  103. 103. Virtual DOM • It’s a pure Javascript, in-memory representation of the DOM • render() fires whenever something changes
  104. 104. Virtual DOM • It’s a pure Javascript, in-memory representation of the DOM • render() fires whenever something changes • React modifies the real DOM to match
  105. 105. Virtual DOM • It’s a pure Javascript, in-memory representation of the DOM • render() fires whenever something changes • React modifies the real DOM to match • It’s FAST
  106. 106. Virtual DOM • It’s a pure Javascript, in-memory representation of the DOM • render() fires whenever something changes • React modifies the real DOM to match • It’s FAST • It’s pure
  107. 107. Virtual DOM • It’s a pure Javascript, in-memory representation of the DOM • render() fires whenever something changes • React modifies the real DOM to match • It’s FAST • It’s pure • It just works
  108. 108. … Except when it doesn’t
  109. 109. … Except when it doesn’t How do I access the actual DOM?
  110. 110. … Except when it doesn’t How do I access the actual DOM? How do I know when render() is done?
  111. 111. … Except when it doesn’t How do I access the actual DOM? How do I know when render() is done?
  112. 112. … Except when it doesn’t How do I access the actual DOM? How do I know when render() is done? Lifecycle Method
  113. 113. … Except when it doesn’t How do I access the actual DOM? How do I know when render() is done? Lifecycle Method Actual DOM Node
  114. 114. Yay! Declarative Templates!
  115. 115. Declarative Templates suck!
  116. 116. Declarative Templates suck! wut.
  117. 117. Declarative Templates suck! wut.
  118. 118. Declarative Templates suck! wut. Sounds legit!
  119. 119. Why all this is awesome
  120. 120. Why all this is awesome • One-way data flow keeps complexity under control
  121. 121. Why all this is awesome • One-way data flow keeps complexity under control • Easy to debug self-contained components
  122. 122. Why all this is awesome • One-way data flow keeps complexity under control • Easy to debug self-contained components • Library doesn’t dictate too much
  123. 123. Why all this is awesome • One-way data flow keeps complexity under control • Easy to debug self-contained components • Library doesn’t dictate too much • Ridiculous potential
  124. 124. A small demo http://www.emergent.info/iphone-hairgate
  125. 125. Where to go from here?
  126. 126. Where to go from here? Official React docs http://facebook.github.io/react/
  127. 127. Where to go from here? Official React docs http://facebook.github.io/react/ TodoMVC git@github.com:tastejs/todomvc.git
  128. 128. Thank You

×