SlideShare a Scribd company logo
1 of 67
Download to read offline
AJAVASCRIPTLIBRARYFORBUILDINGUSERINTERFACE
React
React First Impressions
<!doctype html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>React</title>

<script src="http://fb.me/react-0.13.1.js"></script>

<script src="http://fb.me/JSXTransformer-0.13.1.js"></script>

</head>

<body>

<script type="text/jsx">

/** @jsx React.DOM */

var HelloMessage = React.createClass({

render: function () {

return (

<div><span>hello {this.props.name}</span></div>

)

}

});

React.render(<HelloMessage name="Jungun" />, document.body);

</script>

</body>

</html>
React First Impressions
<!doctype html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>React</title>

<script src="http://fb.me/react-0.13.1.js"></script>

<script src="http://fb.me/JSXTransformer-0.13.1.js"></script>

</head>

<body>

<script type="text/jsx">

/** @jsx React.DOM */

var HelloMessage = React.createClass({

render: function () {

return (

<div><span>hello {this.props.name}</span></div>

)

}

});

React.render(<HelloMessage name="Jungun" />, document.body);

</script>

</body>

</html>
React First Impressions
<!doctype html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>React</title>

<script src="http://fb.me/react-0.13.1.js"></script>

<script src="http://fb.me/JSXTransformer-0.13.1.js"></script>

</head>

<body>

<script type="text/jsx">

/** @jsx React.DOM */

var HelloMessage = React.createClass({

render: function () {

return (

<div><span>hello {this.props.name}</span></div>

)

}

});

React.render(<HelloMessage name="Jungun" />, document.body);

</script>

</body>

</html>
React First Impressions
<!doctype html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>React</title>

<script src="http://fb.me/react-0.13.1.js"></script>

<script src="http://fb.me/JSXTransformer-0.13.1.js"></script>

</head>

<body>

<script type="text/jsx">

/** @jsx React.DOM */

var HelloMessage = React.createClass({

render: function () {

return (

<div><span>hello {this.props.name}</span></div>

)

}

});

React.render(<HelloMessage name="Jungun" />, document.body);

</script>

</body>

</html>
React First Impressions
이상해.. Javascript에 왠 HTML TAG가
Handlebar 같은 템플릿 엔진인가?
React First Impressions
JSX (Javascript XML) : 

XML-LIKE SYNTAX EXTENSION TO ECMASCRIPT
Template Language는 아닌거 같고
자바스크립트로 바뀔 수 있음 (JSXTransformer)
Full stack Javascript랑 비교하면?

Angular.js, Ember.js, Backbone.js
React Has no
...Controllers
...Templates
...Global Event Listeners
...Models
...View Model
JUST
Components
Part 1.
Component 그것은 무엇인가?
Profile
Tweet List
Tweet Item
Tweet Item
Separation of Concens Components
Components are the building blocks of React Applications
Components are composable
Components are map to equivalent DOM nodes
createClass defines a component
render() renders a component definition into the DOM
Props provide the immutable data for a component
State provides the mutable data for a component
Mixins allow reuse between components
Component
Part 2.
React JSX는 왜 쓰는거지?
What is JSX?
JSX is the default syntax and pre-processor for React.
JSX is optional.
Elements are translated to javascript function calls
Attributes

- Cannot be Javascript Reserved words
- The values can be strings or Javascript expressions
Transformation can be
- Just-in-time (developments)
- Precompiled by react-tools (production)
Child expressions allow dynamic component nesting
<div>
<span className=“hello”>hello {this.props.name}</span>
</div>
JSX is optional????
Demo. JSX Transformer
기존에 Markup을 어떻게
JSX로 만들지
HTML to JSX compiler
http://facebook.github.io/react/html-jsx.html
React는 어떻게 하다가
JSX를 이용하게 되었을까?
The History of React
Avoid cross-site scripting attacks(XSS)
Inspired by E4X - openoffice.org에서 사용됨
The History of React
https://github.com/facebook/xhp-lib
https://www.facebook.com/notes/facebook-engineering/xhp-a-new-way-to-write-php/294003943919
dynamic web applications require many roundtrips to the server,
and XHP did not solve this problem
Inspired by XHP, E4X
Requirement : client side, XSS, E4X, Speed
http://thenewstack.io/javascripts-history-and-how-it-led-to-reactjs/
Part 3.
Virtual DOM : React가 빠른 이유
React는 왜 빠른가?
목록항목 <li> 1000개 렌더링 시간 : http://goo.gl/4dKdPz
목록항목 <li> 1000개 렌더링 시간 : http://goo.gl/4dKdPz
목록항목 <li> 1000개 렌더링 시간 : http://goo.gl/4dKdPz
Virtual DOM
DOM을 조작하는 것은 엄청난 비용이 든다.
Javascript에 DOM과 유사한 작은 object를 만들고 조작하는 건 엄청 빠르다.
DOM 조작을 최소화 할 수 있도록
Virtual DOM을 만들고 꼭 변화 해야 하는 부분만 바꾸는 방식
http://stackoverflow.com/questions/2690352/which-is-better-string-html-generation-or-jquery-dom-element-creation
Virtual DOM
Virtual DOM 변경
boolean shouldComponentUpdate(object nextProps, object nextState)
Virtual DOM
1. Data가 변경된다.
2. Virtual DOM을 바꾼다.
3. Virtual DOM에 기존 값과 같다면 Real DOM에 업데이트 하지 않는다.
4. Virtual DOM에 기존 값과 다르다면, 

shouldComponentUpdate 를 호출 한 후 true값이 나온다면 update를 시행한다.
React’s diff algorithm : http://calendar.perfplanet.com/2013/diff/
Part 4.
Data Flow
Data flow
No framework(pure javascript) : 

Any component can communicate with any other component
Backbone.js, Ember.js : Pub-sub (Key-Value Observing)

item.on('change:name', function() { ...
Angular.js : 2-way data binding and $digest loop (Dirty checking)

$scope.name = ...
React : 1-way data flow
Data flow
Data
(value, function)
Props
http://www.slideshare.net/AndrewHull/react-js-and-why-its-awesome
Props
<!doctype html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>React</title>

<script src="http://fb.me/react-0.13.1.js"></script>

<script src="http://fb.me/JSXTransformer-0.13.1.js"></script>

</head>

<body>

<script type="text/jsx">

/** @jsx React.DOM */

var HelloMessage = React.createClass({

render: function () {

return (

<div><span>hello </span></div>

)

}

});

React.render(<HelloMessage />, document.body);

</script>

</body>

</html>
Props
<!doctype html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>React</title>

<script src="http://fb.me/react-0.13.1.js"></script>

<script src="http://fb.me/JSXTransformer-0.13.1.js"></script>

</head>

<body>

<script type="text/jsx">

/** @jsx React.DOM */

var HelloMessage = React.createClass({

render: function () {

return (

<div><span>hello {this.props.name}</span></div>

)

}

});

React.render(<HelloMessage name="Jungun" />, document.body);

</script>

</body>

</html>
Readonly
Component에 변화되는 상태를 저장
하고 싶을 때는 State
State
var App = React.createClass({

getInitialState:function(){

return {

txt: 'the state txt',

id: 0

}

},

update: function(e){

this.setState({txt: e.target.value});

},

render:function(){

return (

<div>

<input type="text" onChange={this.update} />

<h1>{this.state.txt}</h1>

</div>

);

}

});

React.render(<App txt="this is the txt prop" />, document.body);
State
var App = React.createClass({

getInitialState:function(){

return {

txt: 'the state txt', 

id: 0

}

},

update: function(e){

this.setState({txt: e.target.value});

},

render:function(){

return (

<div>

<input type="text" onChange={this.update} />

<h1>{this.state.txt}</h1>

</div>

);

}

});

React.render(<App txt="this is the txt prop" />, document.body);
Read
Update
Create
Event
Data flow
Props State
Passed in from Parent
<MyComp foo=“bar” />
this.props read-only
can be defaulted & validated
getDefaultProps
propTypes
Created within component
getInitialState
this.state to read
this.setState() to update
state should be considered private
Data only flows 1-way
자식Element에서 부모 Element에
Data을 전달하려면?
Javascript is 

Functional Language
<script type="text/jsx">

/** @jsx React.DOM */

var ActionButton = React.createClass({

render: function() {

return (

<button className="ActionButton" onClick={this.props.onAction}>

<span>{this.props.text}</span>

</button>

);

}

});

var APP = React.createClass({

getInitialState: function() {

return {count: this.props.initialCount};

},

addToCount: function(delta) {

this.setState({count: this.state.count + delta})

},

render: function () {

console.log('render')

return (

<div>

<h3>Count: {this.state.count}</h3>

<ActionButton text="+1" onAction={this.addToCount.bind(this, 1)}></ActionButton>

<ActionButton text="-1" onAction={this.addToCount.bind(this, -1)}></ActionButton>

</div>

)

}

});



React.render(<APP initialCount={0}/>, document.getElementById('panel'));

</script>
Props에 함수를 넘기자
Data flow
<script type="text/jsx">

/** @jsx React.DOM */

var ActionButton = React.createClass({

render: function() {

return (

<button className="ActionButton" onClick={this.props.onAction}>

<span>{this.props.text}</span>

</button>

);

}

});

var APP = React.createClass({

getInitialState: function() {

return {count: this.props.initialCount};

},

addToCount: function(delta) {

this.setState({count: this.state.count + delta})

},

render: function () {

console.log('render')

return (

<div>

<h3>Count: {this.state.count}</h3>

<ActionButton text="+1" onAction={this.addToCount.bind(this, 1)}></ActionButton>

<ActionButton text="-1" onAction={this.addToCount.bind(this, -1)}></ActionButton>

</div>

)

}

});



React.render(<APP initialCount={0}/>, document.getElementById('panel'));

</script>
Event 발생한다면
Data flow
Component
Component
ComponentComponent
Component
Component
Props
Props
Props
Props
Props
State
Data flow
State
Component
Component
ComponentComponent
Component
Component
Props
Props
Props
Props
Props
Event
callback
Data flow
setState
Part 5.
Lifecycle
http://facebook.github.io/react/docs/component-specs.html
Components Lifecycle
var MyComponent = React.createClass({

componentWillMount:function(){

console.log(“1. componentWillMount")

},

render: function () {

console.log("2. render")

return (

<button onClick={this.update}>{this.props.val}</button>

)

},

componentDidMount:function(){

console.log("3. componentDidMount")

},

componentWillUnmount:function(){

console.log("4. componentWillUnmount")

}

});
http://facebook.github.io/react/docs/component-specs.html
Components Lifecycle
Mounting
(componentWillMount, componentDidMount)
Updating
(componentWillReceiveProps, shouldComponentUpdate,
ComponentWillUpdate, ComponentDidUpdate)
UnMounting
( componentWillUnmont)
http://facebook.github.io/react/docs/component-specs.html
Demo. Component Lifecycle
Part 5.
Flux
Flux
More of a pattern then a framework
Unidirectional Data Flow - flux pattern
Flux
Dispatcher : Callback registry, Store registry, Dependency Manager
Store : Application Store and logic, Domain Driven
Views (Controller Views) - Controller Views listens for events that are broadcast 

by the stores and pass the data to the descendants
Actions : Dispatcher method payload data contains an action
Action consists of the actual data and its type
Actions may come also from the server.
Flux
Reflux : https://github.com/spoike/refluxjs
Barracks : https://github.com/yoshuawuyts/barracks
Delorean : http://deloreanjs.com/
Fluxy : https://github.com/jmreidy/fluxy
Fluxxor : http://fluxxor.com/
McFly : http://kenwheeler.github.io/mcfly/
Demo. Simple Flux
Part 5.
Relay & GraphQL
Relay & GraphQL
but no yet released
https://facebook.github.io/react/blog/2015/03/19/building-the-facebook-news-feed-with-relay.html
http://facebook.github.io/react/blog/2015/02/20/introducing-relay-and-graphql.html
Tip
React
React
React

More Related Content

What's hot

[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
洪 鹏发
 

What's hot (20)

React js
React jsReact js
React js
 
React js
React jsReact js
React js
 
React hooks
React hooksReact hooks
React hooks
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
 
An Introduction to ReactJS
An Introduction to ReactJSAn Introduction to ReactJS
An Introduction to ReactJS
 
React Context API
React Context APIReact Context API
React Context API
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Reactjs
ReactjsReactjs
Reactjs
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 
Introduction to Redux
Introduction to ReduxIntroduction to Redux
Introduction to Redux
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
ReactJS
ReactJSReactJS
ReactJS
 
React web development
React web developmentReact web development
React web development
 
React workshop
React workshopReact workshop
React workshop
 
React Router: React Meetup XXL
React Router: React Meetup XXLReact Router: React Meetup XXL
React Router: React Meetup XXL
 
React new features and intro to Hooks
React new features and intro to HooksReact new features and intro to Hooks
React new features and intro to Hooks
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
 
React JS
React JSReact JS
React JS
 
React Hooks
React HooksReact Hooks
React Hooks
 

Viewers also liked

Dominio de planificación y organización mjsl
Dominio de planificación y organización mjslDominio de planificación y organización mjsl
Dominio de planificación y organización mjsl
MariaSalazarLopez
 
Asociación Amigos del Alzheimer Almería
Asociación Amigos del Alzheimer AlmeríaAsociación Amigos del Alzheimer Almería
Asociación Amigos del Alzheimer Almería
religioniesaguadulce
 
Redes sociales corporativas
Redes sociales corporativasRedes sociales corporativas
Redes sociales corporativas
Jakinola
 

Viewers also liked (20)

React Tech Salon
React Tech SalonReact Tech Salon
React Tech Salon
 
ReactJS | 서버와 클라이어트에서 동시에 사용하는
ReactJS | 서버와 클라이어트에서 동시에 사용하는ReactJS | 서버와 클라이어트에서 동시에 사용하는
ReactJS | 서버와 클라이어트에서 동시에 사용하는
 
React JS and why it's awesome
React JS and why it's awesomeReact JS and why it's awesome
React JS and why it's awesome
 
다른 회사는 어떻게 QA, 테스팅을 하고 있을까? (google, facebook, atlass...
다른 회사는 어떻게 QA, 테스팅을 하고 있을까? (google, facebook, atlass...다른 회사는 어떻게 QA, 테스팅을 하고 있을까? (google, facebook, atlass...
다른 회사는 어떻게 QA, 테스팅을 하고 있을까? (google, facebook, atlass...
 
eProwin Suite de Software Online
eProwin Suite de Software OnlineeProwin Suite de Software Online
eProwin Suite de Software Online
 
Poly Drum Storage/Dispensing System - DENIOS US
Poly Drum Storage/Dispensing System - DENIOS USPoly Drum Storage/Dispensing System - DENIOS US
Poly Drum Storage/Dispensing System - DENIOS US
 
Dominio de planificación y organización mjsl
Dominio de planificación y organización mjslDominio de planificación y organización mjsl
Dominio de planificación y organización mjsl
 
Asociación Amigos del Alzheimer Almería
Asociación Amigos del Alzheimer AlmeríaAsociación Amigos del Alzheimer Almería
Asociación Amigos del Alzheimer Almería
 
IMG Horizont Artikel VW Soundfoundation
IMG Horizont Artikel VW SoundfoundationIMG Horizont Artikel VW Soundfoundation
IMG Horizont Artikel VW Soundfoundation
 
Bus Karo: Smart Cities and Support Actions for Electromobility
Bus Karo: Smart Cities and Support Actions for ElectromobilityBus Karo: Smart Cities and Support Actions for Electromobility
Bus Karo: Smart Cities and Support Actions for Electromobility
 
Website technical
Website technicalWebsite technical
Website technical
 
#5 "React.js" Антон Артамонов
#5 "React.js" Антон Артамонов#5 "React.js" Антон Артамонов
#5 "React.js" Антон Артамонов
 
React koans
React koansReact koans
React koans
 
Redes sociales corporativas
Redes sociales corporativasRedes sociales corporativas
Redes sociales corporativas
 
구문과 의미론(정적 의미론까지)
구문과 의미론(정적 의미론까지)구문과 의미론(정적 의미론까지)
구문과 의미론(정적 의미론까지)
 
React.js – intro
React.js – introReact.js – intro
React.js – intro
 
Артем Тритяк, Lead Front-End developer в Electric Cloud
 Артем Тритяк, Lead Front-End developer в Electric Cloud Артем Тритяк, Lead Front-End developer в Electric Cloud
Артем Тритяк, Lead Front-End developer в Electric Cloud
 
게임 스타트업 시작하기
게임 스타트업 시작하기게임 스타트업 시작하기
게임 스타트업 시작하기
 
역시 Redux
역시 Redux역시 Redux
역시 Redux
 
React in Native Apps - Meetup React - 20150409
React in Native Apps - Meetup React - 20150409React in Native Apps - Meetup React - 20150409
React in Native Apps - Meetup React - 20150409
 

Similar to React

Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Masashi Shibata
 
Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)
Joao Lucas Santana
 
Dependency Management with RequireJS
Dependency Management with RequireJSDependency Management with RequireJS
Dependency Management with RequireJS
Aaronius
 

Similar to React (20)

Introduction to React and Flux (CodeLabs)
Introduction to React and Flux (CodeLabs)Introduction to React and Flux (CodeLabs)
Introduction to React and Flux (CodeLabs)
 
Let's react - Meetup
Let's react - MeetupLet's react - Meetup
Let's react - Meetup
 
JSF 2.0 Preview
JSF 2.0 PreviewJSF 2.0 Preview
JSF 2.0 Preview
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortal
 
React mit TypeScript – eine glückliche Ehe
React mit TypeScript – eine glückliche EheReact mit TypeScript – eine glückliche Ehe
React mit TypeScript – eine glückliche Ehe
 
ReactJS.ppt
ReactJS.pptReactJS.ppt
ReactJS.ppt
 
JavaServer Pages
JavaServer PagesJavaServer Pages
JavaServer Pages
 
JS-05-Handlebars.ppt
JS-05-Handlebars.pptJS-05-Handlebars.ppt
JS-05-Handlebars.ppt
 
Styling components with JavaScript
Styling components with JavaScriptStyling components with JavaScript
Styling components with JavaScript
 
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django applicationDjangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
 
Pracitcal AJAX
Pracitcal AJAXPracitcal AJAX
Pracitcal AJAX
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Forever
 
Human Talks Riot.js
Human Talks Riot.jsHuman Talks Riot.js
Human Talks Riot.js
 
React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
 
Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)
 
WordPress as the Backbone(.js)
WordPress as the Backbone(.js)WordPress as the Backbone(.js)
WordPress as the Backbone(.js)
 
Angular js
Angular jsAngular js
Angular js
 
Building Applications Using Ajax
Building Applications Using AjaxBuilding Applications Using Ajax
Building Applications Using Ajax
 
Dependency Management with RequireJS
Dependency Management with RequireJSDependency Management with RequireJS
Dependency Management with RequireJS
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 

React

  • 2.
  • 3. React First Impressions <!doctype html>
 <html lang="en">
 <head>
 <meta charset="UTF-8">
 <title>React</title>
 <script src="http://fb.me/react-0.13.1.js"></script>
 <script src="http://fb.me/JSXTransformer-0.13.1.js"></script>
 </head>
 <body>
 <script type="text/jsx">
 /** @jsx React.DOM */
 var HelloMessage = React.createClass({
 render: function () {
 return (
 <div><span>hello {this.props.name}</span></div>
 )
 }
 });
 React.render(<HelloMessage name="Jungun" />, document.body);
 </script>
 </body>
 </html>
  • 4. React First Impressions <!doctype html>
 <html lang="en">
 <head>
 <meta charset="UTF-8">
 <title>React</title>
 <script src="http://fb.me/react-0.13.1.js"></script>
 <script src="http://fb.me/JSXTransformer-0.13.1.js"></script>
 </head>
 <body>
 <script type="text/jsx">
 /** @jsx React.DOM */
 var HelloMessage = React.createClass({
 render: function () {
 return (
 <div><span>hello {this.props.name}</span></div>
 )
 }
 });
 React.render(<HelloMessage name="Jungun" />, document.body);
 </script>
 </body>
 </html>
  • 5. React First Impressions <!doctype html>
 <html lang="en">
 <head>
 <meta charset="UTF-8">
 <title>React</title>
 <script src="http://fb.me/react-0.13.1.js"></script>
 <script src="http://fb.me/JSXTransformer-0.13.1.js"></script>
 </head>
 <body>
 <script type="text/jsx">
 /** @jsx React.DOM */
 var HelloMessage = React.createClass({
 render: function () {
 return (
 <div><span>hello {this.props.name}</span></div>
 )
 }
 });
 React.render(<HelloMessage name="Jungun" />, document.body);
 </script>
 </body>
 </html>
  • 6. React First Impressions <!doctype html>
 <html lang="en">
 <head>
 <meta charset="UTF-8">
 <title>React</title>
 <script src="http://fb.me/react-0.13.1.js"></script>
 <script src="http://fb.me/JSXTransformer-0.13.1.js"></script>
 </head>
 <body>
 <script type="text/jsx">
 /** @jsx React.DOM */
 var HelloMessage = React.createClass({
 render: function () {
 return (
 <div><span>hello {this.props.name}</span></div>
 )
 }
 });
 React.render(<HelloMessage name="Jungun" />, document.body);
 </script>
 </body>
 </html>
  • 7. React First Impressions 이상해.. Javascript에 왠 HTML TAG가 Handlebar 같은 템플릿 엔진인가?
  • 8. React First Impressions JSX (Javascript XML) : 
 XML-LIKE SYNTAX EXTENSION TO ECMASCRIPT Template Language는 아닌거 같고 자바스크립트로 바뀔 수 있음 (JSXTransformer)
  • 9. Full stack Javascript랑 비교하면?
 Angular.js, Ember.js, Backbone.js
  • 10. React Has no ...Controllers ...Templates ...Global Event Listeners ...Models ...View Model JUST Components
  • 12.
  • 14. Separation of Concens Components Components are the building blocks of React Applications Components are composable Components are map to equivalent DOM nodes createClass defines a component render() renders a component definition into the DOM Props provide the immutable data for a component State provides the mutable data for a component Mixins allow reuse between components Component
  • 15. Part 2. React JSX는 왜 쓰는거지?
  • 16. What is JSX? JSX is the default syntax and pre-processor for React. JSX is optional. Elements are translated to javascript function calls Attributes
 - Cannot be Javascript Reserved words - The values can be strings or Javascript expressions Transformation can be - Just-in-time (developments) - Precompiled by react-tools (production) Child expressions allow dynamic component nesting <div> <span className=“hello”>hello {this.props.name}</span> </div>
  • 18.
  • 19.
  • 20.
  • 23. HTML to JSX compiler http://facebook.github.io/react/html-jsx.html
  • 24. React는 어떻게 하다가 JSX를 이용하게 되었을까?
  • 25. The History of React Avoid cross-site scripting attacks(XSS) Inspired by E4X - openoffice.org에서 사용됨
  • 26. The History of React https://github.com/facebook/xhp-lib https://www.facebook.com/notes/facebook-engineering/xhp-a-new-way-to-write-php/294003943919 dynamic web applications require many roundtrips to the server, and XHP did not solve this problem Inspired by XHP, E4X Requirement : client side, XSS, E4X, Speed http://thenewstack.io/javascripts-history-and-how-it-led-to-reactjs/
  • 27. Part 3. Virtual DOM : React가 빠른 이유
  • 28.
  • 30. 목록항목 <li> 1000개 렌더링 시간 : http://goo.gl/4dKdPz
  • 31. 목록항목 <li> 1000개 렌더링 시간 : http://goo.gl/4dKdPz
  • 32. 목록항목 <li> 1000개 렌더링 시간 : http://goo.gl/4dKdPz
  • 33. Virtual DOM DOM을 조작하는 것은 엄청난 비용이 든다. Javascript에 DOM과 유사한 작은 object를 만들고 조작하는 건 엄청 빠르다. DOM 조작을 최소화 할 수 있도록 Virtual DOM을 만들고 꼭 변화 해야 하는 부분만 바꾸는 방식 http://stackoverflow.com/questions/2690352/which-is-better-string-html-generation-or-jquery-dom-element-creation
  • 35. Virtual DOM 변경 boolean shouldComponentUpdate(object nextProps, object nextState)
  • 36. Virtual DOM 1. Data가 변경된다. 2. Virtual DOM을 바꾼다. 3. Virtual DOM에 기존 값과 같다면 Real DOM에 업데이트 하지 않는다. 4. Virtual DOM에 기존 값과 다르다면, 
 shouldComponentUpdate 를 호출 한 후 true값이 나온다면 update를 시행한다. React’s diff algorithm : http://calendar.perfplanet.com/2013/diff/
  • 38. Data flow No framework(pure javascript) : 
 Any component can communicate with any other component Backbone.js, Ember.js : Pub-sub (Key-Value Observing)
 item.on('change:name', function() { ... Angular.js : 2-way data binding and $digest loop (Dirty checking)
 $scope.name = ... React : 1-way data flow
  • 40. Props <!doctype html>
 <html lang="en">
 <head>
 <meta charset="UTF-8">
 <title>React</title>
 <script src="http://fb.me/react-0.13.1.js"></script>
 <script src="http://fb.me/JSXTransformer-0.13.1.js"></script>
 </head>
 <body>
 <script type="text/jsx">
 /** @jsx React.DOM */
 var HelloMessage = React.createClass({
 render: function () {
 return (
 <div><span>hello </span></div>
 )
 }
 });
 React.render(<HelloMessage />, document.body);
 </script>
 </body>
 </html>
  • 41. Props <!doctype html>
 <html lang="en">
 <head>
 <meta charset="UTF-8">
 <title>React</title>
 <script src="http://fb.me/react-0.13.1.js"></script>
 <script src="http://fb.me/JSXTransformer-0.13.1.js"></script>
 </head>
 <body>
 <script type="text/jsx">
 /** @jsx React.DOM */
 var HelloMessage = React.createClass({
 render: function () {
 return (
 <div><span>hello {this.props.name}</span></div>
 )
 }
 });
 React.render(<HelloMessage name="Jungun" />, document.body);
 </script>
 </body>
 </html> Readonly
  • 42. Component에 변화되는 상태를 저장 하고 싶을 때는 State
  • 43. State var App = React.createClass({
 getInitialState:function(){
 return {
 txt: 'the state txt',
 id: 0
 }
 },
 update: function(e){
 this.setState({txt: e.target.value});
 },
 render:function(){
 return (
 <div>
 <input type="text" onChange={this.update} />
 <h1>{this.state.txt}</h1>
 </div>
 );
 }
 });
 React.render(<App txt="this is the txt prop" />, document.body);
  • 44. State var App = React.createClass({
 getInitialState:function(){
 return {
 txt: 'the state txt', 
 id: 0
 }
 },
 update: function(e){
 this.setState({txt: e.target.value});
 },
 render:function(){
 return (
 <div>
 <input type="text" onChange={this.update} />
 <h1>{this.state.txt}</h1>
 </div>
 );
 }
 });
 React.render(<App txt="this is the txt prop" />, document.body); Read Update Create Event
  • 45. Data flow Props State Passed in from Parent <MyComp foo=“bar” /> this.props read-only can be defaulted & validated getDefaultProps propTypes Created within component getInitialState this.state to read this.setState() to update state should be considered private
  • 49. <script type="text/jsx">
 /** @jsx React.DOM */
 var ActionButton = React.createClass({
 render: function() {
 return (
 <button className="ActionButton" onClick={this.props.onAction}>
 <span>{this.props.text}</span>
 </button>
 );
 }
 });
 var APP = React.createClass({
 getInitialState: function() {
 return {count: this.props.initialCount};
 },
 addToCount: function(delta) {
 this.setState({count: this.state.count + delta})
 },
 render: function () {
 console.log('render')
 return (
 <div>
 <h3>Count: {this.state.count}</h3>
 <ActionButton text="+1" onAction={this.addToCount.bind(this, 1)}></ActionButton>
 <ActionButton text="-1" onAction={this.addToCount.bind(this, -1)}></ActionButton>
 </div>
 )
 }
 });
 
 React.render(<APP initialCount={0}/>, document.getElementById('panel'));
 </script> Props에 함수를 넘기자 Data flow
  • 50. <script type="text/jsx">
 /** @jsx React.DOM */
 var ActionButton = React.createClass({
 render: function() {
 return (
 <button className="ActionButton" onClick={this.props.onAction}>
 <span>{this.props.text}</span>
 </button>
 );
 }
 });
 var APP = React.createClass({
 getInitialState: function() {
 return {count: this.props.initialCount};
 },
 addToCount: function(delta) {
 this.setState({count: this.state.count + delta})
 },
 render: function () {
 console.log('render')
 return (
 <div>
 <h3>Count: {this.state.count}</h3>
 <ActionButton text="+1" onAction={this.addToCount.bind(this, 1)}></ActionButton>
 <ActionButton text="-1" onAction={this.addToCount.bind(this, -1)}></ActionButton>
 </div>
 )
 }
 });
 
 React.render(<APP initialCount={0}/>, document.getElementById('panel'));
 </script> Event 발생한다면 Data flow
  • 54. http://facebook.github.io/react/docs/component-specs.html Components Lifecycle var MyComponent = React.createClass({
 componentWillMount:function(){
 console.log(“1. componentWillMount")
 },
 render: function () {
 console.log("2. render")
 return (
 <button onClick={this.update}>{this.props.val}</button>
 )
 },
 componentDidMount:function(){
 console.log("3. componentDidMount")
 },
 componentWillUnmount:function(){
 console.log("4. componentWillUnmount")
 }
 });
  • 58. Flux More of a pattern then a framework Unidirectional Data Flow - flux pattern
  • 59. Flux Dispatcher : Callback registry, Store registry, Dependency Manager Store : Application Store and logic, Domain Driven Views (Controller Views) - Controller Views listens for events that are broadcast 
 by the stores and pass the data to the descendants Actions : Dispatcher method payload data contains an action Action consists of the actual data and its type Actions may come also from the server.
  • 60. Flux Reflux : https://github.com/spoike/refluxjs Barracks : https://github.com/yoshuawuyts/barracks Delorean : http://deloreanjs.com/ Fluxy : https://github.com/jmreidy/fluxy Fluxxor : http://fluxxor.com/ McFly : http://kenwheeler.github.io/mcfly/
  • 62. Part 5. Relay & GraphQL
  • 63. Relay & GraphQL but no yet released https://facebook.github.io/react/blog/2015/03/19/building-the-facebook-news-feed-with-relay.html http://facebook.github.io/react/blog/2015/02/20/introducing-relay-and-graphql.html
  • 64. Tip