SlideShare a Scribd company logo
Modern Web Apps
Development
by Stanimir Todorov
linkedin.com/in/stanimirt
github.com/stanimirtt
stanimir.todorof@gmail.com
Agenda
1. Intro
2. React
3. MobX
4. Redux
5. Angular (if we have the time)
Nowadays
ExecutionProject Files Transpiling
Setup Environment
Project Structure
git clone git@github.com:stanimirtt/modern-web-apps-development-course-2018.git
React
Component
1. JSX
2. ES6 Import Statements
3. ReactDOM
1. Export Statements
2. Class-Based Components
3. Handling User Events
4. State
5. Controlled Components vs Uncontrolled Components
(refs)
Items Page Wireframe
Hands On
AJAX Requests with
React
1. Axios
2. Props
3. Keys
4. Selection
5. Styling
Hands On
Life-cycle methods
MobX
ReactMobX
State
1/ State Should Be Minimally Defined
1. No Caching
2. No Data Duplication
3. No Cascading State Changes
2/ Everything Should Be Derived
1. Automatically
2. Define derivations and reactions
3. Mobx ensures efficiency and consistency
Modern Web Apps Development 101
Modern Web Apps Development 101
observable
Enables MobX to observe your data
observer
MobX ensures that this component is consistent with the state
computed
Mobx ensures that this value is consistent with the state
yarn add mobx mobx-react
1/ Define your state and make it observable
1. import { observable } from 'mobx';
2. const appState = observable({
items: [],
selectedItem: ''
});
2/ Create a view that responds to changes in the
State
1. import { observer } from 'mobx-react';
2. export default observer(App);
3. ReactDOM.render(<App appState={appState} />,
document.querySelector('.container'));
3/ Modify the State
1. appState.setSelectedItem = action(item => {
appState.selectedItem = item;
});
2. this.props.appState.setSelectedItem(response.data);
@decorators
1. yarn add babel-plugin-transform-decorators-legacy -D
2. .babelrc
{
...
"plugins": ["transform-decorators-legacy"]
}
3. .eslintrc.json - "experimentalDecorators": true
React and MobX
1. Provider
2. Inject
Hands On
React Router
Examples for Route
● Route: `http://localhost:8080/`
● Route: `http://localhost:8080/items/5`
● Route: `http://localhost:8080/items/new`
Redux
3 Principles
Single source of truth
State is read-only
Changes are made with pure functions
ReactRedux
Data Modeling
State
The state of your whole application is stored in an object tree within a single store.
console.log(store.getState())
/* Prints
{
itemSelected: {...},
items: [
{
id: 1,
title: 'My Item',
},
...
]
}
*/
Actions
The only way to change the state is to emit an action, an object describing what
happened.
store.dispatch({
type: 'ITEM_SELECTED',
item: { … }
})
Reducers
To specify how the state tree is transformed by actions, you write pure reducers.
function itemSelected(state = [], action) {
switch (action.type) {
case 'ITEM_SELECTED':
return action.item;
default:
return state
}
}
Modern Web Apps Development 101
Containers - Connecting Redux to React
Wrap-up
1. Add reducer in reducers folder with name of state key (Redux)
2. Import the created reducer in reducers/index.js and register with
combineReducers
3. Add action creator in action/index.js file
4. Identify which component need to be connect to the store (Redux)
5. Create a container file in containers folder
6. Import the component that need props and dispatch from the store in that
container
7. Wire the component to the store with the container following these steps:
a. import { connect } from 'react-redux';
b. import { bindActionCreators } from 'redux'; // in case you need to dispatch an action
c. const mapStateToProps = state => ({ items: state.items });
d. const mapDispatchToProps = dispatch => bindActionCreators({ onItemSelect: selectItem }, dispatch);
// in case you need to dispatch an action
a. export default connect(mapStateToProps, mapDispatchToProps)(Component); // name of the imported
component
Hands On
Middleware
Modern Web Apps Development 101
Hands On
Reselect
Angular
Architecture and setup
Modern Web Apps Development 101
Modules
Modules
Modules
Modules
Components
@Component({
selector: 'app-hero-list',
templateUrl: './hero-list.component.html',
providers: [ HeroService ]
})
export class HeroListComponent implements OnInit {
/* . . . */
}
Templates
<h2>Hero List</h2>
<p><i>Pick a hero from the list</i></p>
<ul>
<li *ngFor="let hero of heroes"
(click)="selectHero(hero)">
{{hero.name}}
</li>
</ul>
<app-hero-detail *ngIf="selectedHero"
[hero]="selectedHero"></app-hero-detail>
Data binding
<li>{{hero.name}}</li>
<app-hero-detail
[hero]="selectedHero"></app-hero-detail>
<li (click)="selectHero(hero)"></li>
Modern Web Apps Development 101
Pipes
<!-- Default format: output 'Jun 15, 2015'-->
<p>Today is {{today | date}}</p>
<!-- fullDate format: output 'Monday, June 15, 2015'-->
<p>The date is {{today | date:'fullDate'}}</p>
<!-- shortTime format: output '9:43 AM'-->
<p>The time is {{today | date:'shortTime'}}</p>
Directives
● Structural directives
<li *ngFor="let hero of heroes"></li>
<app-hero-detail
*ngIf="selectedHero"></app-hero-detail>
● Attribute directives
<input [(ngModel)]="hero.name">
Services
export class Logger {
log(msg: any) { console.log(msg); }
error(msg: any) { console.error(msg); }
warn(msg: any) { console.warn(msg); }
}
Services
export class HeroService {
private heroes: Hero[] = [];
constructor(
private backend: BackendService,
private logger: Logger) { }
getHeroes() {
this.backend.getAll(Hero).then( (heroes:
Hero[]) => {
this.logger.log(`Fetched
${heroes.length} heroes.`);
this.heroes.push(...heroes); // fill cache
});
return this.heroes;
}
}
Dependency Injection
constructor(private service: HeroService) { }
Application Lifecycle
Resources
● https://github.com/ryanmcdermott/clean-code-javascript#introduction
● https://vasanthk.gitbooks.io/react-bits/
● https://github.com/stanimirtt/modern-web-apps-development-course-2018
● https://gist.github.com/stanimirtt/4537fe1ad1f3c209043e305dc0e2b990

More Related Content

PPTX
Multiplayer Server Scaling with Azure Container Instances
PDF
React js use contexts and useContext hook
PDF
Extending Kubernetes with Operators
PDF
MBLTDev15: Cesar Valiente, Wunderlist
PPTX
React-JS Component Life-cycle Methods
PDF
Introduction to React Hooks
PPTX
ReactJS (1)
PPTX
Damian Kmiecik - Road trip with Redux
Multiplayer Server Scaling with Azure Container Instances
React js use contexts and useContext hook
Extending Kubernetes with Operators
MBLTDev15: Cesar Valiente, Wunderlist
React-JS Component Life-cycle Methods
Introduction to React Hooks
ReactJS (1)
Damian Kmiecik - Road trip with Redux

What's hot (20)

PPTX
Dependency Inversion in large-scale TypeScript applications with InversifyJS
PDF
MBLTDev15: Egor Tolstoy, Rambler&Co
PPTX
Introduction to MongoDB
PDF
React js t7 - forms-events
PPTX
ReactJS for Beginners
PDF
React js t1 - introduction
PPTX
ASP.NET Page Life Cycle
PPTX
Kubernetes Service Catalog & Open Service Broker for Azure
PPTX
Getting Started With ReactJS
PPTX
Introduction to Jquery
PDF
Aspnet Life Cycles Events
PPTX
Advanced Jquery
PPTX
Better web apps with React and Redux
PPTX
React / Redux Architectures
PDF
React js t5 - state
PDF
React js t8 - inlinecss
PPTX
Page life cycle IN ASP.NET
PDF
React.js and Redux overview
PDF
React js t6 -lifecycle
Dependency Inversion in large-scale TypeScript applications with InversifyJS
MBLTDev15: Egor Tolstoy, Rambler&Co
Introduction to MongoDB
React js t7 - forms-events
ReactJS for Beginners
React js t1 - introduction
ASP.NET Page Life Cycle
Kubernetes Service Catalog & Open Service Broker for Azure
Getting Started With ReactJS
Introduction to Jquery
Aspnet Life Cycles Events
Advanced Jquery
Better web apps with React and Redux
React / Redux Architectures
React js t5 - state
React js t8 - inlinecss
Page life cycle IN ASP.NET
React.js and Redux overview
React js t6 -lifecycle
Ad

Similar to Modern Web Apps Development 101 (20)

PPTX
React with Redux
PDF
React js
PPTX
Presentation1
PPTX
React JS .NET
PPTX
Spfx with react redux
PDF
Fundamental concepts of react js
PPTX
Dyanaimcs of business and economics unit 2
PDF
How to use redux with react hooks in react native application
PPTX
Intro react js
PDF
Fundamental Concepts of React JS for Beginners.pdf
PPTX
React JS: A Secret Preview
PPTX
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology
PDF
React for Re-use: Creating UI Components with Confluence Connect
PPTX
Academy PRO: React JS. Redux & Tooling
PDF
React Native for multi-platform mobile applications
PPTX
Meteor
PDF
A React Journey
PPTX
How To Utilize Context API With Class And Functional Componen in React.pptx
PPTX
React + Redux + TypeScript === ♥
PDF
Workshop 20: ReactJS Part II Flux Pattern & Redux
React with Redux
React js
Presentation1
React JS .NET
Spfx with react redux
Fundamental concepts of react js
Dyanaimcs of business and economics unit 2
How to use redux with react hooks in react native application
Intro react js
Fundamental Concepts of React JS for Beginners.pdf
React JS: A Secret Preview
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology
React for Re-use: Creating UI Components with Confluence Connect
Academy PRO: React JS. Redux & Tooling
React Native for multi-platform mobile applications
Meteor
A React Journey
How To Utilize Context API With Class And Functional Componen in React.pptx
React + Redux + TypeScript === ♥
Workshop 20: ReactJS Part II Flux Pattern & Redux
Ad

Recently uploaded (20)

PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
Cost to Outsource Software Development in 2025
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
iTop VPN Crack Latest Version Full Key 2025
PDF
CapCut Video Editor 6.8.1 Crack for PC Latest Download (Fully Activated) 2025
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
Autodesk AutoCAD Crack Free Download 2025
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Salesforce Agentforce AI Implementation.pdf
Cost to Outsource Software Development in 2025
wealthsignaloriginal-com-DS-text-... (1).pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Digital Systems & Binary Numbers (comprehensive )
iTop VPN Crack Latest Version Full Key 2025
CapCut Video Editor 6.8.1 Crack for PC Latest Download (Fully Activated) 2025
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Design an Analysis of Algorithms II-SECS-1021-03
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Autodesk AutoCAD Crack Free Download 2025
Advanced SystemCare Ultimate Crack + Portable (2025)
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
Navsoft: AI-Powered Business Solutions & Custom Software Development

Modern Web Apps Development 101

Editor's Notes

  • #5: VS Code Extensions: GitLense Prettier formatter ESLint Spelling Checker Settings for VS Code: https://gist.github.com/stanimirtt/4537fe1ad1f3c209043e305dc0e2b990
  • #8: http://babeljs.io/repl/#?babili=false&browsers=&build=&builtIns=false&code_lz=MYewdgzgLgBAggBwTAvDAFASlQPhgHgBMBLANxwCUBTAQ2FmsIFcAPGAYRCYCcIr8A9CXIBuAFBA&debug=false&circleciRepo=&evaluate=true&lineWrap=true&presets=es2015%2Creact%2Cstage-2&prettier=false&targets=&version=6.26.0
  • #11: 01 Intro Into React Components
  • #14: 02 AJAX Requests with React
  • #29: 03 React with MobX How you should model your state?
  • #30: https://reacttraining.com/react-router/web/example/basic https://github.com/ReactTraining/react-router
  • #33: https://github.com/reactjs/redux/blob/master/docs/introduction/ThreePrinciples.md
  • #42: 04 React with Redux
  • #45: 05 Redux Middleware
  • #46: https://github.com/reactjs/reselect
  • #48: Angular CLI