Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
[React Meetup Campinas 2017] Porque React criou...
Search
Talysson de Oliveira Cassiano
May 10, 2017
Programming
240
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
[React Meetup Campinas 2017] Porque React criou uma revolução - e você devia saber disso
Talysson de Oliveira Cassiano
May 10, 2017
More Decks by Talysson de Oliveira Cassiano
See All by Talysson de Oliveira Cassiano
[Explore DDD 2026] LLM AIs as domain experts
talyssonoc
0
70
[DDD Europe 2026] So you want to be a DDD practitioner
talyssonoc
0
140
[Tropical on Rails 2026] Privacy on Rails
talyssonoc
1
150
[Nerdearla Argentina 2025] LLMs as domain experts
talyssonoc
0
78
[TDC SP 2025] Então você quer ser um praticante de DDD
talyssonoc
0
92
[DDD Brasil] Então você quer ser um praticante de DDD
talyssonoc
0
68
[Rails World 2025 Lighting Talks] Where is it?! - Avoiding the XY Problem
talyssonoc
0
75
[TDC Floripa 2025] Abordagens funcionais efetivas em TypeScript com Effect-TS
talyssonoc
0
140
[TDC Floripa 2025] Modelagem de domínios como construção de teorias
talyssonoc
0
120
Other Decks in Programming
See All in Programming
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
120
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
610
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
380
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
220
npm との違いを手がかりにGo の依存管理を理解したい
optim
0
660
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
1
440
Domain-Driven Transformation
hschwentner
2
2.3k
パズルゲームの作り方 / how to make puzzle games
kaityo256
PRO
2
300
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5.2k
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
790
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
Featured
See All Featured
New Earth Scene 8
popppiees
4
2.7k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
560
Done Done
chrislema
187
17k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
GitHub's CSS Performance
jonrohan
1033
470k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Speed Design
sergeychernyshev
33
2.2k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
440
Transcript
Porquê o React criou uma revolução E você devia saber
disso
Talysson @talyssonoc talyssonoc.github.io Front-end Codeminer42
React?!
“ Uma biblioteca JavaScript para construir interfaces de usuário. -
React, Documentação do
C M V
C M
¡Viva la revolución reacción!
Componentização
class GreetMessage extends React.Component { render() { return ( <div>
Hey, { this.props.name }. </div> ); } } ReactDOM.render( <GreetMessage name="Meetup attendant"/>, document.querySelector('#app') );
Antes // app.js angular.module('meetup', []) .controller('GreetCtrl', function($scope) { $scope.name =
'Meetup attendant'; }); // app.html <div ng-controller="GreetCtrl"> Hey, {{ name }}. </div> // app.js App.GreetMsgView = Ember.View.extend({ templateName: 'greet_msg' }); App.HomePageView = Ember.View.extend({ templateName: 'home_page', name: 'Meetup speaker' }); // home_page template {{#view 'greet_msg'}} // greet_msg template Hello, {{name}} Angular < 1.5 Ember 1.x
Depois // app.js angular.module('meetup', []) .controller('GreetCtrl', function($scope) { $scope.name =
'Meetup attendant'; }) .component('greetMsg', { template: 'Hey, {{ $ctrl.name }}.', bindings: { name: '=' } }); // app.html <div ng-controller="GreetCtrl"> <greet-msg name="name"></greet-msg> </div> // app.js App.GreetMsgComponent = Ember.Component.extend({ templateName: 'greet_msg' }); App.HomePageView = Ember.View.extend({ templateName: 'home_page', name: 'Meetup speaker' }); // home_page template {{greet-msg name=name}} // greet_msg template Hello, {{name}} Angular 1.5+ Ember 2.x
Composição
class GreetMessage extends React.Component { render() { return ( <div>
Hey, { this.props.name }. </div> ); } } class HomePage extends React.Component { render() { return ( <div> <h1>Welcome</h1> <GreetMessage name="Meetup attendant"/> </div> ); } } ReactDOM.render( <HomePage />, document.querySelector('#app') );
Antes Angular 1.x // greetMsg.js angular.module('meetup') .component('greetMsg', { bindings: {
name: '=' }, template: ` <div ng-click="$ctrl.handleClick()"> Hey, {{$ctrl.name}} </div>`, controller() { this.handleClick = function() { this.name = 'speaker'; }; } }); // homePage.js angular.module('meetup') .component('homePage', { template: ` <h1>{{$ctrl.theName | uppercase}}</h1> <greet-msg name="$ctrl.theName"></greet-msg> `, controller() { this.theName = 'attendant'; } });
Antes Backbone var HomePageView = Backbone.View.extend({ initialize: function() { this.greetAttendants
= new GreetMsgView({ model: { name: 'attendants'} }); this.greetSpeakers = new GreetMsgView({ model: { name: 'speakers'} }); }, render: function() { this.$el.append( this.greetAttendants.render().$el, this.greetSpeakers.render().$el ); } });
Depois Angular 2.x // greetMsg.ts @Component({ selector: 'greet-msg', template: `
<div (click)="handleClick()"> Hey, {{ name }} </div> ` }) export class GreetMsg { @Input() name = ''; handleClick() { this.name = 'speakers'; } } // homePage.ts @Component({ selector: 'home-page', directives: [GreetMsg], template: ` {{ theName | uppercase }} <greet-msg [name]="theName"></greet-msg> `, }) export class HomePage { constructor() { this.theName = 'attendants'; } }
Depois Backbone ¯\_(ツ)_/¯
Funcional
const makeBoldComponent = (Component) => { return (props) => <b><Component
{...props}/></b>; }; const GreetMessage = (props) => ( <div> Hey, { props.name }. </div> ); const BoldGreetMessage = makeBoldComponent(GreetMessage); const HomePage = () => ( <div> <h1>Welcome</h1> <BoldGreetMessage name="Meetup attendant"/> </div> ); ReactDOM.render( <HomePage />, document.querySelector('#app') );
Vantagens ▸ Favorece imutabilidade e pureza ▸ Código mais limpo
e menos classes ▸ Componentes de alta ordem ▸ Reduz uso do this ▸ Mais fácil de testar ▸ Melhor performance ▸ Memoização
Antes Angular Ember Backbone Vue Knockout
Depois CycleJS Elm Reagent Om Om Deku
Fluxo único de dados
Controller Model View Antes
Action Data Component Depois
Vantagens ▸ Maior previsibilidade ▸ Mais fácil de pensar sobre
▸ Mais fácil de encontrar causa de bugs ▸ Maior escalabilidade no front-end
CycleJS Elm Redux Flux Vuex X Ember 2 Data ⬇,
actions ⬆ Relay
Virtual DOM & Tree diff V-DOM
V-DOM
Preact V-DOM Ember 2/Glimmer CycleJS RiotJS Mithril Vue 2 Inferno
Elm
React/JSX é só JavaScript
“ Interfaces de usuário são simplesmente projeções de uma forma
de dado em outra forma de dado.
Antes <ul> <li ng-repeat="item in items"> <a ng-href="{{ item.url }}">
{{ item.title }} <span ng-if="item.subtitle"> - {{ item.subtitle }} </span> </a> </li> </ul> <ul> <li v-for="item in items"> <a v-bind:href="{{ item.url }}"> {{ item.title }} <span v-if="item.subtitle"> - {{ item.subtitle }} </span> </a> </li> </ul> Angular 1.x Vue
Antes <ul> {{#each item in items}} <li> {{#link-to 'items.show' item}}
{{ item.title }} {{#if item.subtitle }} - {{ item.subtitle }} {{/if}} {{/link-to}} </li> {{/each}} </ul> Ember/Handlebars
React com JSX <ul> { items.map((item) => ( <li> <a
href={ item.url }> { item.title } { item.subtitle && `- ${ item.subtitle }` } </a> </li> )) } </ul> const linkItems = items.map((item) => ( <li> <a href={ item.url }> { item.title } { item.subtitle && `- ${ item.subtitle }` } </a> </li> )); <ul> { linkItems } </ul>
React sem JSX const h = React.createElement; h('ul', null, items.map((item)
=> ( h('li', null, h('a', { href: item.url }, item.title, item.subtitle && `- ${ item.subtitle }` ) ) )) ); const h = React.createElement; const linkItems = items.map((item) => ( h('li', null, h('a', { href: item.url }, item.title, item.subtitle && `- ${ item.subtitle }` ) ) )); h('ul', null, linkItems );
Depois h('ul', items$.map((item) => ( h('li', h('a', { href: item.url
}, [ item.title, item.subtitle && `- ${ item.subtitle }` ]) ))) ); CycleJS <ul> { items.map((item) => ( <li> <a href={ item.url }> { item.title } { item.subtitle && `- ${ item.subtitle }` } </a> </li> )) } </ul> Inferno
Depois m('ul', items.map((item) => ( m('li', m('a', { href: item.url
}, [ item.title, item.subtitle && `- ${ item.subtitle }` ]) ))) ); Mithril <ul> { items.map((item) => ( <li> <a href={ item.url }> { item.title } { item.subtitle && `- ${ item.subtitle }` } </a> </li> )) } </ul> Preact
Interoperabilidade
None
Vantagens ▸ Adoção gradual, sem reescrita ▸ Integração simples, é
só JavaScript ▸ Biblioteca focada em UI ▸ Tamanho permite ser usada em conjunto (44kb)
Renderização do front-end no server
O problema ▸ Não-SPAs carregam mais que o necessário ▸
SPAs demoram para fazer o primeiro render ▸ SPAs tem problemas com SEO (sem hacks)
A solução ▸ Renderizar o máximo do front-end no servidor
▸ “Montar” a aplicação no HTML já renderizado ▸ Carregar apenas dados a partir daí ▸ Primeira tentativa: Backbone Rendr
Com React const html = ReactDOMServer.render( <HomePage /> ); ReactDOM.render(
<HomePage />, document.querySelector('#app') ); Servidor Cliente
CycleJS Vue 2 Ember FastBoot Angular Universal
Mundo mobile
Antes: o problema ▸ Manter várias aplicações mobile inteiras é
custoso ▸ Soluções híbridas com WebView são ineficazes ▸ O mercado mobile exige apps para todos SOs
import { View, Text } from 'react-native'; const GreetMessage =
(props) => ( <Text>Hey, { props.name }</Text> ); class GreetMobileDeveloper extends Component { render() { return ( <View> <GreetMessage name="Meetup mobile developer" /> </View> ); } } Com React Native
ReactXP Depois
O futuro
create-react-app ▸ CLI para desenvolvimento com React ▸ Tooling totalmente
configurado ▸ Já vem com suporte a testes ▸ Fácil para começar a produzir na hora
React Fiber ▸ Algoritmo de renderização incremental ▸ Mudança no
agendamento da renderização ▸ Possibilidade de renderizar via stream ▸ Renderização no servidor (ainda) mais efetiva ▸ Fragments
O React-way ▸ Componentes isolados, combináveis e reutilizáveis ▸ Fluxo
único de dados ▸ Virtual DOM ▸ Somente JavaScript
“ Don’t Rewrite, React! - Ryan Florence
? Perguntas? Talysson @talyssonoc talyssonoc.github.io
Obrigado! Talysson @talyssonoc talyssonoc.github.io