SlideShare a Scribd company logo
A React Journey
A tour of the latest trends in the React ecosystem
JS Frontend Developer at LinkMe Srl
Twitter: @_denb
In love with React and Javascript in general.
I’m a 7-month-old dad
Daniele Bertella
JS Frontend Jr Developer at LinkMe Srl
Twitter: @paolorovella
In love with React and sushi, i’m an
incurable tv shows binge watcher
Paolo Rovella
React
React is a JavaScript library for
creating user interfaces
https://facebook.github.io/react
ReactMain concepts
Just the UI
React is only concerned
about rendering UI
Virtual DOM
React uses a Virtual DOM
Diff implementation for
ultra-high performance
Data Flow
React introduces one-way
reactive data flow
Components
ReactA basic component
ReactJSX
JSX is a XML-like syntax
extension to ECMAScript
https://facebook.github.io/jsx/
ReactComponent Specs
getInitialState()
Invoked once before the component is
mounted. The return value will be
used as the initial value of this.state.
getDefaultProps()
Invoked once, before any instances are
created. The return value will be used
as the initial value of this.props.
propTypes
The propTypes object allows you to validate props being
passed to your components
ReactProps
Input data that is passed into the
component and can be accessed
via this.props
The propTypes object allows you
to validate props being passed to
your components
PropTypes validation provided
https://facebook.github.io/react/docs/reusable-components.html#prop-validation
ReactState
Internal state data
A component can maintain internal
state data (accessed via this.state)
Re-render on state changes
When a component's state data
changes, the rendered markup will
be updated by re-invoking render()
ReactComponent Lifecycles
Various methods are executed at
specific points in a component's
lifecycle.
https://facebook.github.io/react/docs/component-specs.html#lifecycle-methods
ReactMixins
Share common functionality
Break repetitive tasks out into
standalone pieces optionally
included within one or more
components.
React
ECMAScript 6 (ES6) is the upcoming sixth major release of
the ECMAScript language specification.
ES6 support is different among browsers
(https://kangax.github.io/compat-table/es6/)
You can use ES6 today thanks to transpilers like Babel
ECMAScript 6 (ES6)
Babel
Javascript compiler
Transpile ES6/ES7 in ES5
(Classes / Destructuring / Arrow functions /
Spread operator ...)
http://babeljs.io
BabelLearn ES6
http://babeljs.io/docs/learn-es2015/
ReactES5 to ES6 Classes
ECMAScript 6 equivalents in ES5 by @addyosmani
https://github.com/addyosmani/es6-equivalents-in-es5
React
ES6 Destructuring
ES6 Arrow function
Expression that make it possible to
extract data from arrays or object into
dinstinct variables
Shorter syntax compared to function
expressions and binds the “this” value
(not its own this). They are always
anonymous
React
ES6 Object Spread operator
ES6 Decorators
Copy properties from one object to another.
The specification order is important
Syntactic sugar which lets you
annotate and modify classes at
design time
ReactStateless Functional Components
Kill boilerplate code
Dumb and predictable
component
No state, no component
lifecycles
ReactHigh Order Components
Reuse other components
functionalities
Reduce duplication of code
Mixins Are Dead. Long Live Composition
https://medium.com/@dan_abramov/mixins-are-dead-long-live-higher-order-components-94a0d2f9e750
ReactHigh Order Components
Thanks @cef62 (Matteo Ronchi)
https://speakerdeck.com/cef62/higher-order-
components-in-react-at-voxxed-days-ticino-2016
ReactRouting (react-router) https://github.com/reactjs/react-router
State management
ReduxBy Dan Abramov (@dan_abramov)
https://github.com/reactjs/redux
Predictable state container for JavaScript apps.
Three principles
- Single source of truth
- State is read only
- Changes are made with pure functions
ReduxApp state
App state described as a plain object
This object is like a “model” except
that there are no setters
ReduxActions
The only way to mutate the state is to emit an action, an object
describing what happened
ReduxReducers
A function that takes previous state
and action as arguments, and
returns the next state of the app
Split reducers in smaller functions
managing parts of the state
ReduxReducers
A reducer that manage the complete state
can call other small reducers
ReduxAPI
combineReducers
Combine different
reducers in one
createStore
Two arguments, combined
reducers and persisted state
(optional)
Redux
subscribe
Adds a change listener. Called any time an
action is dispatched, and some part of the state
tree may potentially have changed
getState
Returns an object with the current state tree
of your application
dispatch
Dispatches an action. This is the only way to
trigger a state change
Store
Reduxreact-redux
Presentational and Container Components
Provider
makes the store available to all
container components in the app
only need to use it once when you
render the root component
Reduxreact-redux
Reduxreact-redux
connect(params)(Component)
connects a React component
to a Redux store.
returns a new, connected
component class
Reduxreact-redux
mapStateToProps
a function that tell how to transform the
current Redux store state into the props
you want to pass.
mapDispatchToProps
a function that receives dispatch()
method and returns a callback props.
ReduxMiddlewares
Suggested way to extend Redux with
custom functionality
They are called after an action is
dispatched and before it reaches the
reducer
Multiple middlewares can be combined
together
Redux Saga middleware let you create Sagas, which are
generators responsible for orchestrating complex/asynchronous
operations, to gather all your side effects logic in a central place
Redux
redux-thunk
https://github.com/gaearon/redux-thunk
Middlewares
Redux Thunk middleware allows you to write action creators that
return a function instead of an action
The thunk can be used to delay the dispatch of an action, or to
dispatch only if a certain condition is met
redux-saga
https://github.com/yelouafi/redux-saga
MobXBy Michel Weststrate (@mweststrate)
https://github.com/mobxjs/mobx
MobX is a library that makes state management
simple and scalable by transparently applying
functional reactive programming
Functional reactive programming
Functional reactive programming is programming
with asynchronous data streams which you can
listen to and react accordingly
The introduction to Reactive Programming you've been missing
https://gist.github.com/staltz/868e7e9bc2a7b8c1f754
MobXStore (observable/computed)
@observable state
observable capabilities to objects, arrays
and class instances annotating properties
with the @observable decorator
@computed
values that will be derived automatically
when relevant data is modified
@action
action is anything that modify
the state and is always triggered
by some event (DOM events,
websockets etc)
MobXStore (action)
MobX
@observer
observer function / decorator is used
to turn ReactJS components into
reactive components.
In this component store can be
passed as a prop
mobx-react
MobXFlow
API overview
https://mobxjs.github.io/mobx/refguide/api.html
In-depth explanation of MobX
https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-
explanation-of-mobservable-55995262a254
Testing
EnzymeBy Airbnb (@airbnb)
https://github.com/airbnb/enzyme
Enzyme is a JavaScript testing utility for React.
React components are easy to test because they simply return
a description for what UI of the component should look like.
This “description” is the “Virtual DOM” and is a tree-like
data structure
Enzyme
Shallow is the recommended mode to start
with since it does a better job of isolating your
tests to just a single component
Shallow rendering
Enzyme exports three different “modes” to render and test components:
shallow, mount, and render.
Enzyme
Enzyme Selectors can find nodes by
4 categories:
CSS selectors
React component constructor
React component display name
Object properties
Enzyme selectors
Enzyme
Concise and elegant way of simulating
user events, one of the trickier aspects
of UI testing.
Just pass the name of the event you
want to simulate, along with any
required data
Event simulations
Webpack
Module bundler
Loaders
Plugins
http://webpack.github.io
WebpackModule bundler
WebpackLoaders
Test
A regular expression that matches the file extensions that
should run through this loader (required)
Include / Exclude
Set which folders and files the loader should add or ignore
Loader
The name of the loader (required)
Query
Used to pass Additional options to the loader
WebpackPlugins
Tutorial
http://www.pro-react.com/materials/appendixA
Plugins have the ability to inject
themselves into the build process to
introduce custom behaviors.
They do not operate like loaders on
individual source files: they influence
the build process as a whole.
CSS in JShttps://github.com/MicheleBertoli/css-in-js
React: CSS in JS techniques comparison
CSS Modules
Concept of using a module bundler, such
as webpack, to load CSS scoped to a
particular document
https://github.com/css-modules/css-modules
CSS ModulesWebpack configuration
https://github.com/css-modules/webpack-demo
CSS ModulesHow to use
CSS ModulesComposition
https://github.com/css-modules/webpack-
demo/tree/master/src/components/3-ClassComposition
CSS ModulesComposition
Atomic CSS Modules
https://medium.com/yplan-eng/atomic-css-modules-cb44d5993b27
https://speakerdeck.com/michelebertoli/css-in-js
One more thing...
https://speakerdeck.com/paolorovella/react-native
Corso su ReactJS
Corso su ReactJS

More Related Content

PDF
Automate App Container Delivery with CI/CD and DevOps
PDF
Messaging with the Docker
PDF
Server(less) Swift at SwiftCloudWorkshop 3
PPTX
Jenkins, pipeline and docker
PDF
Stop Being Lazy and Test Your Software
PDF
Building kubectl plugins with Quarkus | DevNation Tech Talk
PDF
Deployment Automation with Docker
PDF
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Automate App Container Delivery with CI/CD and DevOps
Messaging with the Docker
Server(less) Swift at SwiftCloudWorkshop 3
Jenkins, pipeline and docker
Stop Being Lazy and Test Your Software
Building kubectl plugins with Quarkus | DevNation Tech Talk
Deployment Automation with Docker
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf

What's hot (20)

PPTX
Simply your Jenkins Projects with Docker Multi-Stage Builds
PDF
Continuous delivery with jenkins, docker and exoscale
PDF
Building Efficient Parallel Testing Platforms with Docker
PDF
Machine learning with Apache Spark on Kubernetes | DevNation Tech Talk
PDF
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
PDF
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
PDF
Monitoring Akka with Kamon 1.0
PPTX
Pipeline as code - new feature in Jenkins 2
PDF
Introduction to Functional Reactive Web with Clojurescript
PDF
Rails Applications with Docker
PDF
Developer joy for distributed teams with CodeReady Workspaces | DevNation Tec...
PDF
Language Server Protocol - Why the Hype?
PPTX
Learn kubernetes in 90 minutes
PDF
Ansible, integration testing, and you.
PDF
Dockerfiles building docker images automatically v (workdir, env, add, and ...
PDF
Pluggable Infrastructure with CI/CD and Docker
PDF
Brief intro to K8s controller and operator
PPTX
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
PDF
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
PDF
Openshift: The power of kubernetes for engineers - Riga Dev Days 18
Simply your Jenkins Projects with Docker Multi-Stage Builds
Continuous delivery with jenkins, docker and exoscale
Building Efficient Parallel Testing Platforms with Docker
Machine learning with Apache Spark on Kubernetes | DevNation Tech Talk
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Monitoring Akka with Kamon 1.0
Pipeline as code - new feature in Jenkins 2
Introduction to Functional Reactive Web with Clojurescript
Rails Applications with Docker
Developer joy for distributed teams with CodeReady Workspaces | DevNation Tec...
Language Server Protocol - Why the Hype?
Learn kubernetes in 90 minutes
Ansible, integration testing, and you.
Dockerfiles building docker images automatically v (workdir, env, add, and ...
Pluggable Infrastructure with CI/CD and Docker
Brief intro to K8s controller and operator
Build, Publish, Deploy and Test Docker images and containers with Jenkins Wor...
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Openshift: The power of kubernetes for engineers - Riga Dev Days 18
Ad

Similar to Corso su ReactJS (20)

PDF
A React Journey
PPTX
React + Redux + TypeScript === ♥
PPTX
React gsg presentation with ryan jung & elias malik
PPTX
React-JS.pptx
PPTX
React js programming concept
PDF
OttawaJS - React
PPTX
React JS - A quick introduction tutorial
PPTX
Introduction to React JS.pptx
PPTX
ReactJS (1)
PPTX
Introduction to ReactJS UI Web Dev .pptx
PDF
Lezione 03 Introduzione a react
PDF
Fundamental concepts of react js
PPTX
React & Redux JS
PPTX
ReactJS.pptx
PDF
React Interview Question PDF By ScholarHat
PDF
Full Stack React Workshop [CSSC x GDSC]
PDF
100 React Interview questions 2024.pptx.pdf
PPTX
unit 2 React js.pptxdgdgdgdgdgdgdgdgdsgdgdg
PPTX
React - Start learning today
PPTX
React js
A React Journey
React + Redux + TypeScript === ♥
React gsg presentation with ryan jung & elias malik
React-JS.pptx
React js programming concept
OttawaJS - React
React JS - A quick introduction tutorial
Introduction to React JS.pptx
ReactJS (1)
Introduction to ReactJS UI Web Dev .pptx
Lezione 03 Introduzione a react
Fundamental concepts of react js
React & Redux JS
ReactJS.pptx
React Interview Question PDF By ScholarHat
Full Stack React Workshop [CSSC x GDSC]
100 React Interview questions 2024.pptx.pdf
unit 2 React js.pptxdgdgdgdgdgdgdgdgdsgdgdg
React - Start learning today
React js
Ad

More from LinkMe Srl (7)

PDF
Adventures in docker compose
PDF
Webdriver.io
PDF
Angular Intermediate
PDF
NodeJS
PDF
Angular js quickstart
PDF
M&M - MeanMilan @CodeMotionMilan
PPTX
Presentazione Codemotion
Adventures in docker compose
Webdriver.io
Angular Intermediate
NodeJS
Angular js quickstart
M&M - MeanMilan @CodeMotionMilan
Presentazione Codemotion

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
Cloud computing and distributed systems.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation theory and applications.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Chapter 3 Spatial Domain Image Processing.pdf
A Presentation on Artificial Intelligence
Cloud computing and distributed systems.
20250228 LYD VKU AI Blended-Learning.pptx
Review of recent advances in non-invasive hemoglobin estimation
Mobile App Security Testing_ A Comprehensive Guide.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Understanding_Digital_Forensics_Presentation.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
The AUB Centre for AI in Media Proposal.docx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation theory and applications.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
The Rise and Fall of 3GPP – Time for a Sabbatical?
CIFDAQ's Market Insight: SEC Turns Pro Crypto

Corso su ReactJS