SlideShare a Scribd company logo
1 of 34
Download to read offline
Реактивная
тяга
Ярослав Савченко
EPAM
Problem
Complicated and unpredictable state
MVC
Real MVC
UI = f(state)
Flux
Flux
React
“ We built React to solve one problem: building
large applications with data that changes over
time. “
React documentation
Virtual DOM
React - Hello world
class HelloMessage extends React.Component {
constructor(props) {
super(props);
}
render() {
return <div>Hello {this.props.name}</div>;
}
}
React - Hello world
class HelloMessage extends React.Component {
constructor(props) {
super(props);
}
render() {
return <div>Hello {this.props.name}</div>;
}
}
React - JSX
render() {
return <div>Hello {this.props.name}</div>;
}
render() {
return React.createElement("div", null, "Hello ", this.props.name);
}
“ We think that markup and the code that
generates it are intimately tied together. ”
React documentation
React - component creation
class HelloMessage extends React.Component {
constructor(props) {
super(props);
}
render() {
return <div>Hello {this.props.name}</div>;
}
}
ReactDOM.render(<HelloMessage name="World" />, mountNode);
React - props
class HelloMessage extends React.Component {
constructor(props) {
super(props);
}
render() {
return <div onClick={this.props.handleClick}>
Hello {this.props.name}
</div>;
}
}
ReactDOM.render(<HelloMessage
name="World"
handleClick={someCallback} />, mountNode);
React - props validation
class HelloMessage extends React.Component {
propTypes: {
name: React.PropTypes.string,
name: React.PropTypes.oneOf(["World", "People"])
},
constructor(props) { /* … */ }
render() {
return <div>Hello {this.props.name}</div>;
}
}
React - state
class HelloMessage extends React.Component {
constructor(props) {
super(props);
this.state = { name: this.props.name || "World" };
}
handleClick = (event) => {
this.setState({ name: event.target.value });
}
render() {
return (<div>Hello
<input
value={this.state.name}
onChange={this.handleClick}/>
</div>);
}
}
React - stateless function
const HelloMessage = (props) => {
let name = props.name.toUpperCase();
return <div>Hello {this.props.name}</div>
}
/* or */
const HelloMessage = ({name}) => <div>Hello {name}</div>;
Component Lifecycle
Mount
Update
Unmount
...
Update
Component Lifecycle
Mount
- getDefaultProps
- getInitialState
- componentWillMount
- render
- componentDidMount
Update
- componentWillReceiveProps
- shouldComponentUpdate
- componentWillUpdate
- render
- componentDidUpdate
Unmount
- componentWillUnmount
Redux
Redux
… is a predictable state container for JavaScript apps.
Three Principles:
● Single source of truth
● State is read-only
● Changes are made with pure functions
Redux
Single source of truth
The state of your whole application is stored in an object tree within a single store
let initialState = {
todos: [ {...}, {...}, … {...} ],
filter: "active"
}
Redux
State is read-only
The only way to mutate the state is to emit an action, an object describing what
happened
const action = {
type: SET_VISIBILITY_FILTER,
filter: "active"
}
Redux
Changes are made with pure functions
Pure reducers specify the state tree transformations by actions
const todoApp = (state = initialState, action) => {
switch (action.type) {
case SET_VISIBILITY_FILTER:
return {...state, visibilityFilter: action.filter};
default:
return state;
}
}
Redux
The Store is the object that brings them together
Create store:
let store = createStore(todoApp, initialState);
Dispatch an action:
store.dispatch(filterAction);
Subscribe/unsubscribe
let unsubscribe = store.subscribe(() =>
console.log(store.getState());
);
Why React and Redux?
Because now UI=React(Redux)
Advantages of these approach
● Simplify app
● Debugging
● Testing
● Performance
● Reusability
● Bleeding-edge features
(Server-side render, CSS Modules etc.)
Problems
● Javascript Fatigue
● Build (React, Redux, react-redux,
react-router, ES2015, Babel,
webpack)
● Only View and Store
● Inconsistent React docs
● Big size (React ~26kb,
Backbone ~20kb, Angular ~40kb)
Holywar?
Links to start with
● Pete Hunt: React How-to
https://github.com/petehunt/react-howto
● Getting started with React
http://facebook.github.io/react/docs/getting-started.html
● Dan Abramov: Getting started with Redux
https://egghead.io/series/getting-started-with-redux
● 0 to 1 : Getting started with Redux
http://www.jchapron.com/2015/08/14/getting-started-with-redux/
https://habrahabr.ru/post/269831/
Thanks,
and have a good flight!

More Related Content

What's hot

What's hot (20)

React&redux
React&reduxReact&redux
React&redux
 
Ngrx: Redux in angular
Ngrx: Redux in angularNgrx: Redux in angular
Ngrx: Redux in angular
 
Introduction to react and redux
Introduction to react and reduxIntroduction to react and redux
Introduction to react and redux
 
Deep Dive into React Hooks
Deep Dive into React HooksDeep Dive into React Hooks
Deep Dive into React Hooks
 
Let's Redux!
Let's Redux!Let's Redux!
Let's Redux!
 
React и redux
React и reduxReact и redux
React и redux
 
Ngrx slides
Ngrx slidesNgrx slides
Ngrx slides
 
React, Redux, ES2015 by Max Petruck
React, Redux, ES2015   by Max PetruckReact, Redux, ES2015   by Max Petruck
React, Redux, ES2015 by Max Petruck
 
Introduction to Redux
Introduction to ReduxIntroduction to Redux
Introduction to Redux
 
React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overview
 
React hooks
React hooksReact hooks
React hooks
 
Ngrx
NgrxNgrx
Ngrx
 
Intro to React | DreamLab Academy
Intro to React | DreamLab AcademyIntro to React | DreamLab Academy
Intro to React | DreamLab Academy
 
React lecture
React lectureReact lecture
React lecture
 
Egghead redux-cheat-sheet-3-2-1
Egghead redux-cheat-sheet-3-2-1Egghead redux-cheat-sheet-3-2-1
Egghead redux-cheat-sheet-3-2-1
 
Getting Started with NgRx (Redux) Angular
Getting Started with NgRx (Redux) AngularGetting Started with NgRx (Redux) Angular
Getting Started with NgRx (Redux) Angular
 
React 101
React 101React 101
React 101
 
Damian Kmiecik - Road trip with Redux
Damian Kmiecik - Road trip with ReduxDamian Kmiecik - Road trip with Redux
Damian Kmiecik - Road trip with Redux
 
Using React, Redux and Saga with Lottoland APIs
Using React, Redux and Saga with Lottoland APIsUsing React, Redux and Saga with Lottoland APIs
Using React, Redux and Saga with Lottoland APIs
 
Building complex User Interfaces with Sitecore and React
Building complex User Interfaces with Sitecore and ReactBuilding complex User Interfaces with Sitecore and React
Building complex User Interfaces with Sitecore and React
 

Viewers also liked

Разработка в долг
Разработка в долгРазработка в долг
Разработка в долгVitebsk Miniq
 
Осторожно, не упадите! Идет работа с real-time данными
Осторожно, не упадите! Идет работа с real-time даннымиОсторожно, не упадите! Идет работа с real-time данными
Осторожно, не упадите! Идет работа с real-time даннымиVitebsk Miniq
 
Презентация для детей "Светлая Пасха"
Презентация для детей "Светлая Пасха"Презентация для детей "Светлая Пасха"
Презентация для детей "Светлая Пасха"rechrebenka
 
Тестируем тесты с PIT (мутационное тестирование)
Тестируем тесты с PIT (мутационное тестирование)Тестируем тесты с PIT (мутационное тестирование)
Тестируем тесты с PIT (мутационное тестирование)Vitebsk Miniq
 
Easily create apps using Phonegap
Easily create apps using PhonegapEasily create apps using Phonegap
Easily create apps using PhonegapDevOWL Meetup
 
SEO basics for developers
SEO basics for developersSEO basics for developers
SEO basics for developersDevOWL Meetup
 
Database reverse engineering
Database reverse engineeringDatabase reverse engineering
Database reverse engineeringDevOWL Meetup
 
Startup tactics for developers: A, B, C
Startup tactics for developers: A, B, CStartup tactics for developers: A, B, C
Startup tactics for developers: A, B, CDevOWL Meetup
 
Как и зачем мы тестируем UI
Как и зачем мы тестируем UIКак и зачем мы тестируем UI
Как и зачем мы тестируем UIVyacheslav Lyalkin
 
ECMAScript 5 Features
ECMAScript 5 FeaturesECMAScript 5 Features
ECMAScript 5 FeaturesDevOWL Meetup
 
Соревнования по программированию
Соревнования по программированиюСоревнования по программированию
Соревнования по программированиюVitebsk Miniq
 
Async Module Definition via RequireJS
Async Module Definition via RequireJSAsync Module Definition via RequireJS
Async Module Definition via RequireJSDevOWL Meetup
 
Trainspotting Transporting: RabbitMQ, Akka.NET, Rx, MVI, Cycle.js
Trainspotting Transporting: RabbitMQ, Akka.NET, Rx, MVI, Cycle.jsTrainspotting Transporting: RabbitMQ, Akka.NET, Rx, MVI, Cycle.js
Trainspotting Transporting: RabbitMQ, Akka.NET, Rx, MVI, Cycle.jsDevOWL Meetup
 
CQRS and EventSourcing
CQRS and EventSourcingCQRS and EventSourcing
CQRS and EventSourcingDevOWL Meetup
 
AngularJS basics & theory
AngularJS basics & theoryAngularJS basics & theory
AngularJS basics & theoryDevOWL Meetup
 

Viewers also liked (20)

Разработка в долг
Разработка в долгРазработка в долг
Разработка в долг
 
Осторожно, не упадите! Идет работа с real-time данными
Осторожно, не упадите! Идет работа с real-time даннымиОсторожно, не упадите! Идет работа с real-time данными
Осторожно, не упадите! Идет работа с real-time данными
 
Презентация для детей "Светлая Пасха"
Презентация для детей "Светлая Пасха"Презентация для детей "Светлая Пасха"
Презентация для детей "Светлая Пасха"
 
Тестируем тесты с PIT (мутационное тестирование)
Тестируем тесты с PIT (мутационное тестирование)Тестируем тесты с PIT (мутационное тестирование)
Тестируем тесты с PIT (мутационное тестирование)
 
Easily create apps using Phonegap
Easily create apps using PhonegapEasily create apps using Phonegap
Easily create apps using Phonegap
 
Bootstrap3 basics
Bootstrap3 basicsBootstrap3 basics
Bootstrap3 basics
 
SEO basics for developers
SEO basics for developersSEO basics for developers
SEO basics for developers
 
Lucene in Action
Lucene in ActionLucene in Action
Lucene in Action
 
Database reverse engineering
Database reverse engineeringDatabase reverse engineering
Database reverse engineering
 
devOWL coffee-break
devOWL coffee-breakdevOWL coffee-break
devOWL coffee-break
 
HR VS DEV
HR VS DEVHR VS DEV
HR VS DEV
 
Startup tactics for developers: A, B, C
Startup tactics for developers: A, B, CStartup tactics for developers: A, B, C
Startup tactics for developers: A, B, C
 
Testing is coming
Testing is comingTesting is coming
Testing is coming
 
Как и зачем мы тестируем UI
Как и зачем мы тестируем UIКак и зачем мы тестируем UI
Как и зачем мы тестируем UI
 
ECMAScript 5 Features
ECMAScript 5 FeaturesECMAScript 5 Features
ECMAScript 5 Features
 
Соревнования по программированию
Соревнования по программированиюСоревнования по программированию
Соревнования по программированию
 
Async Module Definition via RequireJS
Async Module Definition via RequireJSAsync Module Definition via RequireJS
Async Module Definition via RequireJS
 
Trainspotting Transporting: RabbitMQ, Akka.NET, Rx, MVI, Cycle.js
Trainspotting Transporting: RabbitMQ, Akka.NET, Rx, MVI, Cycle.jsTrainspotting Transporting: RabbitMQ, Akka.NET, Rx, MVI, Cycle.js
Trainspotting Transporting: RabbitMQ, Akka.NET, Rx, MVI, Cycle.js
 
CQRS and EventSourcing
CQRS and EventSourcingCQRS and EventSourcing
CQRS and EventSourcing
 
AngularJS basics & theory
AngularJS basics & theoryAngularJS basics & theory
AngularJS basics & theory
 

Similar to Reactивная тяга

Manage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's ReduxManage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's ReduxCommit University
 
Getting started with Redux js
Getting started with Redux jsGetting started with Redux js
Getting started with Redux jsCitrix
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners Varun Raj
 
Workshop 20: ReactJS Part II Flux Pattern & Redux
Workshop 20: ReactJS Part II Flux Pattern & ReduxWorkshop 20: ReactJS Part II Flux Pattern & Redux
Workshop 20: ReactJS Part II Flux Pattern & ReduxVisual Engineering
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with ReduxVedran Blaženka
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation洪 鹏发
 
How to use redux with react hooks in react native application
How to use redux with react hooks in react native applicationHow to use redux with react hooks in react native application
How to use redux with react hooks in react native applicationKaty Slemon
 
Recompacting your react application
Recompacting your react applicationRecompacting your react application
Recompacting your react applicationGreg Bergé
 
Combining Angular and React Together
Combining Angular and React TogetherCombining Angular and React Together
Combining Angular and React TogetherSebastian Pederiva
 
React & Redux for noobs
React & Redux for noobsReact & Redux for noobs
React & Redux for noobs[T]echdencias
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today Nitin Tyagi
 
React and MobX: A Truly Reactive App
React and MobX:  A Truly Reactive AppReact and MobX:  A Truly Reactive App
React and MobX: A Truly Reactive AppJacob Orshalick
 
A full introductory guide to React
A full introductory guide to ReactA full introductory guide to React
A full introductory guide to ReactJean Carlo Emer
 
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!JS Fest 2019. Glenn Reyes. With great power comes great React hooks!
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!JSFestUA
 
Build web apps with react js
Build web apps with react jsBuild web apps with react js
Build web apps with react jsdhanushkacnd
 

Similar to Reactивная тяга (20)

Manage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's ReduxManage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's Redux
 
Getting started with Redux js
Getting started with Redux jsGetting started with Redux js
Getting started with Redux js
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 
React/Redux
React/ReduxReact/Redux
React/Redux
 
Workshop 20: ReactJS Part II Flux Pattern & Redux
Workshop 20: ReactJS Part II Flux Pattern & ReduxWorkshop 20: ReactJS Part II Flux Pattern & Redux
Workshop 20: ReactJS Part II Flux Pattern & Redux
 
React outbox
React outboxReact outbox
React outbox
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with Redux
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
 
How to use redux with react hooks in react native application
How to use redux with react hooks in react native applicationHow to use redux with react hooks in react native application
How to use redux with react hooks in react native application
 
ReactJS
ReactJSReactJS
ReactJS
 
Recompacting your react application
Recompacting your react applicationRecompacting your react application
Recompacting your react application
 
Combining Angular and React Together
Combining Angular and React TogetherCombining Angular and React Together
Combining Angular and React Together
 
React & Redux for noobs
React & Redux for noobsReact & Redux for noobs
React & Redux for noobs
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
React and MobX: A Truly Reactive App
React and MobX:  A Truly Reactive AppReact and MobX:  A Truly Reactive App
React and MobX: A Truly Reactive App
 
A full introductory guide to React
A full introductory guide to ReactA full introductory guide to React
A full introductory guide to React
 
Intro react js
Intro react jsIntro react js
Intro react js
 
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!JS Fest 2019. Glenn Reyes. With great power comes great React hooks!
JS Fest 2019. Glenn Reyes. With great power comes great React hooks!
 
Understanding redux
Understanding reduxUnderstanding redux
Understanding redux
 
Build web apps with react js
Build web apps with react jsBuild web apps with react js
Build web apps with react js
 

More from Vitebsk Miniq

Runtime compilation and code execution in groovy
Runtime compilation and code execution in groovyRuntime compilation and code execution in groovy
Runtime compilation and code execution in groovyVitebsk Miniq
 
The 5 Laws of Software Estimates
The 5 Laws of Software EstimatesThe 5 Laws of Software Estimates
The 5 Laws of Software EstimatesVitebsk Miniq
 
Latest & Greatest Observability Release 7.9
Latest & Greatest Observability Release 7.9Latest & Greatest Observability Release 7.9
Latest & Greatest Observability Release 7.9Vitebsk Miniq
 
Тестирование Spring-based приложений
Тестирование Spring-based приложенийТестирование Spring-based приложений
Тестирование Spring-based приложенийVitebsk Miniq
 
Семантический поиск - что это, как работает и чем отличается от просто поиска
Семантический поиск - что это, как работает и чем отличается от просто поискаСемантический поиск - что это, как работает и чем отличается от просто поиска
Семантический поиск - что это, как работает и чем отличается от просто поискаVitebsk Miniq
 
Локализационное тестирование - это не только перевод
Локализационное тестирование - это не только переводЛокализационное тестирование - это не только перевод
Локализационное тестирование - это не только переводVitebsk Miniq
 
ISTQB Сертификация тестировщиков: быть или не быть?
ISTQB Сертификация тестировщиков: быть или не быть?ISTQB Сертификация тестировщиков: быть или не быть?
ISTQB Сертификация тестировщиков: быть или не быть?Vitebsk Miniq
 
Apollo GraphQL Federation
Apollo GraphQL FederationApollo GraphQL Federation
Apollo GraphQL FederationVitebsk Miniq
 
Who is a functional tester
Who is a functional testerWho is a functional tester
Who is a functional testerVitebsk Miniq
 
Вперед в прошлое
Вперед в прошлоеВперед в прошлое
Вперед в прошлоеVitebsk Miniq
 
CloudFormation experience
CloudFormation experienceCloudFormation experience
CloudFormation experienceVitebsk Miniq
 
Learning Intelligence: the story of mine
Learning Intelligence: the story of mineLearning Intelligence: the story of mine
Learning Intelligence: the story of mineVitebsk Miniq
 
Как программисты могут спасти мир
Как программисты могут спасти мирКак программисты могут спасти мир
Как программисты могут спасти мирVitebsk Miniq
 
Использование AzureDevOps при разработке микросервисных приложений
Использование AzureDevOps при разработке микросервисных приложенийИспользование AzureDevOps при разработке микросервисных приложений
Использование AzureDevOps при разработке микросервисных приложенийVitebsk Miniq
 
Distributed tracing system in action. Instana Tracing.
Distributed tracing system in action. Instana Tracing.Distributed tracing system in action. Instana Tracing.
Distributed tracing system in action. Instana Tracing.Vitebsk Miniq
 
Насорил - убери!
Насорил - убери!Насорил - убери!
Насорил - убери!Vitebsk Miniq
 
Styled-components. Что? Когда? И зачем?
Styled-components. Что? Когда? И зачем?Styled-components. Что? Когда? И зачем?
Styled-components. Что? Когда? И зачем?Vitebsk Miniq
 
Красные флаги и розовые очки
Красные флаги и розовые очкиКрасные флаги и розовые очки
Красные флаги и розовые очкиVitebsk Miniq
 
CSS. Практика
CSS. ПрактикаCSS. Практика
CSS. ПрактикаVitebsk Miniq
 

More from Vitebsk Miniq (20)

Runtime compilation and code execution in groovy
Runtime compilation and code execution in groovyRuntime compilation and code execution in groovy
Runtime compilation and code execution in groovy
 
The 5 Laws of Software Estimates
The 5 Laws of Software EstimatesThe 5 Laws of Software Estimates
The 5 Laws of Software Estimates
 
Latest & Greatest Observability Release 7.9
Latest & Greatest Observability Release 7.9Latest & Greatest Observability Release 7.9
Latest & Greatest Observability Release 7.9
 
Тестирование Spring-based приложений
Тестирование Spring-based приложенийТестирование Spring-based приложений
Тестирование Spring-based приложений
 
Семантический поиск - что это, как работает и чем отличается от просто поиска
Семантический поиск - что это, как работает и чем отличается от просто поискаСемантический поиск - что это, как работает и чем отличается от просто поиска
Семантический поиск - что это, как работает и чем отличается от просто поиска
 
Локализационное тестирование - это не только перевод
Локализационное тестирование - это не только переводЛокализационное тестирование - это не только перевод
Локализационное тестирование - это не только перевод
 
ISTQB Сертификация тестировщиков: быть или не быть?
ISTQB Сертификация тестировщиков: быть или не быть?ISTQB Сертификация тестировщиков: быть или не быть?
ISTQB Сертификация тестировщиков: быть или не быть?
 
Apollo GraphQL Federation
Apollo GraphQL FederationApollo GraphQL Federation
Apollo GraphQL Federation
 
Who is a functional tester
Who is a functional testerWho is a functional tester
Who is a functional tester
 
Crawling healthy
Crawling healthyCrawling healthy
Crawling healthy
 
Вперед в прошлое
Вперед в прошлоеВперед в прошлое
Вперед в прошлое
 
CloudFormation experience
CloudFormation experienceCloudFormation experience
CloudFormation experience
 
Learning Intelligence: the story of mine
Learning Intelligence: the story of mineLearning Intelligence: the story of mine
Learning Intelligence: the story of mine
 
Как программисты могут спасти мир
Как программисты могут спасти мирКак программисты могут спасти мир
Как программисты могут спасти мир
 
Использование AzureDevOps при разработке микросервисных приложений
Использование AzureDevOps при разработке микросервисных приложенийИспользование AzureDevOps при разработке микросервисных приложений
Использование AzureDevOps при разработке микросервисных приложений
 
Distributed tracing system in action. Instana Tracing.
Distributed tracing system in action. Instana Tracing.Distributed tracing system in action. Instana Tracing.
Distributed tracing system in action. Instana Tracing.
 
Насорил - убери!
Насорил - убери!Насорил - убери!
Насорил - убери!
 
Styled-components. Что? Когда? И зачем?
Styled-components. Что? Когда? И зачем?Styled-components. Что? Когда? И зачем?
Styled-components. Что? Когда? И зачем?
 
Красные флаги и розовые очки
Красные флаги и розовые очкиКрасные флаги и розовые очки
Красные флаги и розовые очки
 
CSS. Практика
CSS. ПрактикаCSS. Практика
CSS. Практика
 

Recently uploaded

Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 

Recently uploaded (20)

Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 

Reactивная тяга

  • 4. MVC
  • 10. “ We built React to solve one problem: building large applications with data that changes over time. “ React documentation
  • 12. React - Hello world class HelloMessage extends React.Component { constructor(props) { super(props); } render() { return <div>Hello {this.props.name}</div>; } }
  • 13. React - Hello world class HelloMessage extends React.Component { constructor(props) { super(props); } render() { return <div>Hello {this.props.name}</div>; } }
  • 14. React - JSX render() { return <div>Hello {this.props.name}</div>; } render() { return React.createElement("div", null, "Hello ", this.props.name); }
  • 15. “ We think that markup and the code that generates it are intimately tied together. ” React documentation
  • 16. React - component creation class HelloMessage extends React.Component { constructor(props) { super(props); } render() { return <div>Hello {this.props.name}</div>; } } ReactDOM.render(<HelloMessage name="World" />, mountNode);
  • 17. React - props class HelloMessage extends React.Component { constructor(props) { super(props); } render() { return <div onClick={this.props.handleClick}> Hello {this.props.name} </div>; } } ReactDOM.render(<HelloMessage name="World" handleClick={someCallback} />, mountNode);
  • 18. React - props validation class HelloMessage extends React.Component { propTypes: { name: React.PropTypes.string, name: React.PropTypes.oneOf(["World", "People"]) }, constructor(props) { /* … */ } render() { return <div>Hello {this.props.name}</div>; } }
  • 19. React - state class HelloMessage extends React.Component { constructor(props) { super(props); this.state = { name: this.props.name || "World" }; } handleClick = (event) => { this.setState({ name: event.target.value }); } render() { return (<div>Hello <input value={this.state.name} onChange={this.handleClick}/> </div>); } }
  • 20. React - stateless function const HelloMessage = (props) => { let name = props.name.toUpperCase(); return <div>Hello {this.props.name}</div> } /* or */ const HelloMessage = ({name}) => <div>Hello {name}</div>;
  • 22. Component Lifecycle Mount - getDefaultProps - getInitialState - componentWillMount - render - componentDidMount Update - componentWillReceiveProps - shouldComponentUpdate - componentWillUpdate - render - componentDidUpdate Unmount - componentWillUnmount
  • 23. Redux
  • 24. Redux … is a predictable state container for JavaScript apps. Three Principles: ● Single source of truth ● State is read-only ● Changes are made with pure functions
  • 25. Redux Single source of truth The state of your whole application is stored in an object tree within a single store let initialState = { todos: [ {...}, {...}, … {...} ], filter: "active" }
  • 26. Redux State is read-only The only way to mutate the state is to emit an action, an object describing what happened const action = { type: SET_VISIBILITY_FILTER, filter: "active" }
  • 27. Redux Changes are made with pure functions Pure reducers specify the state tree transformations by actions const todoApp = (state = initialState, action) => { switch (action.type) { case SET_VISIBILITY_FILTER: return {...state, visibilityFilter: action.filter}; default: return state; } }
  • 28. Redux The Store is the object that brings them together Create store: let store = createStore(todoApp, initialState); Dispatch an action: store.dispatch(filterAction); Subscribe/unsubscribe let unsubscribe = store.subscribe(() => console.log(store.getState()); );
  • 29. Why React and Redux? Because now UI=React(Redux)
  • 30. Advantages of these approach ● Simplify app ● Debugging ● Testing ● Performance ● Reusability ● Bleeding-edge features (Server-side render, CSS Modules etc.)
  • 31. Problems ● Javascript Fatigue ● Build (React, Redux, react-redux, react-router, ES2015, Babel, webpack) ● Only View and Store ● Inconsistent React docs ● Big size (React ~26kb, Backbone ~20kb, Angular ~40kb)
  • 33. Links to start with ● Pete Hunt: React How-to https://github.com/petehunt/react-howto ● Getting started with React http://facebook.github.io/react/docs/getting-started.html ● Dan Abramov: Getting started with Redux https://egghead.io/series/getting-started-with-redux ● 0 to 1 : Getting started with Redux http://www.jchapron.com/2015/08/14/getting-started-with-redux/ https://habrahabr.ru/post/269831/
  • 34. Thanks, and have a good flight!