SlideShare a Scribd company logo
What'snewinReact?
HTGrenoble November 2018 - @sabativi
VictorSabatier
Freelance Web and mobile
developper.
Build stuff using Meteor,
GraphQL, React and React native.
Love learning and sharing
victor@reactivic.com
HTGrenoble November 2018 - @sabativi
Thisisnot
HTGrenoble November 2018 - @sabativi
May2017
HTGrenoble November 2018 - @sabativi
React was invented as an alternative to manual
DOM manipulation.
HTGrenoble November 2018 - @sabativi
· Virtual DOM.
· One way data flow.
· Reconciliation
HTGrenoble November 2018 - @sabativi
Reactchangelog
HTGrenoble November 2018 - @sabativi
· Fragments
· LifeCycle deprecation
· Context API
· Memo
· Lazy with Suspense
HTGrenoble November 2018 - @sabativi
Fragments
import React, { Fragment } from 'react';
...
render() {
return (
<Fragment>
Some text.
<h2>A heading</h2>
</Fragment>
);
}
HTGrenoble November 2018 - @sabativi
LifeCycledeprecation
· UNSAFE_componentWillMount
· UNSAFE_componentWillReceiveProps
· UNSAFE_componentWillUpdate
HTGrenoble November 2018 - @sabativi
LifeCyclemethodsthatreplacemostusecases
· getSnapshotBeforeUpdate
· componentDidUpdate
· getDerivateStateFromProps
HTGrenoble November 2018 - @sabativi
ContextAPI
· Avoid props drilling
· Avoid using redux when hitting this problem.
· Example
HTGrenoble November 2018 - @sabativi
Memo
It is React.PureComponent for function
component.
const MyComponent = React.memo(function MyComponent(props) {
/* render using props */
});
HTGrenoble November 2018 - @sabativi
Lazy
Before
import OtherComponent from './OtherComponent';
function MyComponent() {
return (
<div>
<OtherComponent />
</div>
);
}
HTGrenoble November 2018 - @sabativi
Lazy
A!er
const OtherComponent = React.lazy(() => import('./OtherComponent'));
function MyComponent() {
return (
<div>
<OtherComponent />
</div>
);
}
HTGrenoble November 2018 - @sabativi
Applyitnow1
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import React, { Suspense, lazy } from 'react';
const Home = lazy(() => import('./routes/Home'));
const About = lazy(() => import('./routes/About'));
const App = () => (
<Router>
<Suspense fallback={<div>Loading...</div>}>
<Switch>
<Route exact path="/" component={Home}/>
<Route path="/about" component={About}/>
</Switch>
</Suspense>
</Router>
);
1
If not using SSR, if so ReactLoadable
HTGrenoble November 2018 - @sabativi
Bonus:hooks2
2
In react 16.7.alpha. Not production ready.
HTGrenoble November 2018 - @sabativi
Add local state to function component
import { useState } from 'react';
function Example() {
// Declare a new state variable, which we'll call "count"
const [count, setCount] = useState(0);
return (
<Fragment>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
</button>
</Fragment>
);
}
HTGrenoble November 2018 - @sabativi
Reusestatefullogicnotstate.
import { useState, useEffect } from 'react';
function useFriendStatus(friendID) {
const [isOnline, setIsOnline] = useState(null);
function handleStatusChange(status) {
setIsOnline(status.isOnline);
}
useEffect(() => {
ChatAPI.subscribeToFriendStatus(friendID, handleStatusChange);
return () => {
ChatAPI.unsubscribeFromFriendStatus(friendID, handleStatusChange);
};
});
return isOnline;
}
HTGrenoble November 2018 - @sabativi
function FriendStatus(props) {
const isOnline = useFriendStatus(props.friend.id);
if (isOnline === null) {
return 'Loading...';
}
return isOnline ? 'Online' : 'Offline';
}
function FriendListItem(props) {
const isOnline = useFriendStatus(props.friend.id);
return (
<li style={{ color: isOnline ? 'green' : 'black' }}>
{props.friend.name}
</li>
);
}
HTGrenoble November 2018 - @sabativi
HooksisthefutureofReact
HTGrenoble November 2018 - @sabativi
Thanks
HTGrenoble November 2018 - @sabativi

More Related Content

PDF
Serverless GraphQL @ServerlessConf New York
PPTX
Advanced guide to Quartz plugin
ODP
Scheduler_session
PDF
Full-Stack Reativo com Spring WebFlux + Angular - Devs Java Girl
PDF
Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018
PDF
GraphQL API on a Serverless Environment
PDF
Load test REST APIs using gatling
PDF
Angular 2 observables
Serverless GraphQL @ServerlessConf New York
Advanced guide to Quartz plugin
Scheduler_session
Full-Stack Reativo com Spring WebFlux + Angular - Devs Java Girl
Full-Stack Reactive with Spring WebFlux + Angular - Oracle Code One 2018
GraphQL API on a Serverless Environment
Load test REST APIs using gatling
Angular 2 observables

What's hot (20)

PDF
Reactive Cocoa
PDF
Airflow introduction
PDF
Apollo. The client we deserve
PPTX
Jump into React-Native (Class 5)
PDF
AppSyncをReactで使ってみた
PDF
FullStack Reativo com Spring WebFlux + Angular
PPTX
License plate detection using cloud api's
PPTX
.NET Fest 2018. Vagif Abilov. Akka + F# = Akkling
PPTX
[Codemash] Caching Made "Bootiful"!
PDF
Graphql
PPTX
Join semantics in kafka streams
PDF
From business requirements to working pipelines with apache airflow
PPTX
Airflow presentation
PPTX
KliqMap for Esri: Actionable Location Analytics
PPTX
KliqObjects Overview
PPTX
DOM & Events
PPTX
Calling AWS Lambda through Amazon Alexa
PDF
Continuous performance management with Gatling
PDF
Serverless Angular, Material, Firebase and Google Cloud applications
PPTX
KliqPlan Overview
Reactive Cocoa
Airflow introduction
Apollo. The client we deserve
Jump into React-Native (Class 5)
AppSyncをReactで使ってみた
FullStack Reativo com Spring WebFlux + Angular
License plate detection using cloud api's
.NET Fest 2018. Vagif Abilov. Akka + F# = Akkling
[Codemash] Caching Made "Bootiful"!
Graphql
Join semantics in kafka streams
From business requirements to working pipelines with apache airflow
Airflow presentation
KliqMap for Esri: Actionable Location Analytics
KliqObjects Overview
DOM & Events
Calling AWS Lambda through Amazon Alexa
Continuous performance management with Gatling
Serverless Angular, Material, Firebase and Google Cloud applications
KliqPlan Overview
Ad

Similar to What's new in React (20)

PDF
Intro to React | DreamLab Academy
PDF
Road to react hooks
PDF
100 React Interview questions 2024.pptx.pdf
PPTX
2.React tttttttttttttttttttttttttttttttt
PPTX
React Workshop: Core concepts of react
PPTX
React workshop
PDF
React for Dummies
PDF
React && React Native workshop
PDF
Quick start with React | DreamLab Academy #2
PPTX
React & Redux for noobs
PPTX
[Final] ReactJS presentation
PDF
ReactJS presentation
PDF
Thinking in React
PPTX
React + Redux Introduction
PPTX
React JS: A Secret Preview
PPTX
React/Redux
PPTX
Introduction to react and redux
PPTX
React, Flux and more (p1)
PDF
React Interview Questions and Answers by Scholarhat
PPTX
ReactJS (1)
Intro to React | DreamLab Academy
Road to react hooks
100 React Interview questions 2024.pptx.pdf
2.React tttttttttttttttttttttttttttttttt
React Workshop: Core concepts of react
React workshop
React for Dummies
React && React Native workshop
Quick start with React | DreamLab Academy #2
React & Redux for noobs
[Final] ReactJS presentation
ReactJS presentation
Thinking in React
React + Redux Introduction
React JS: A Secret Preview
React/Redux
Introduction to react and redux
React, Flux and more (p1)
React Interview Questions and Answers by Scholarhat
ReactJS (1)
Ad

More from sabativi (9)

PDF
L'open source m'a tuer*
PDF
Summer 2017
PDF
React Native - Rex - HTGrenoble
PDF
React Fiber
PDF
De git à la blockchain
PDF
Double spending
PDF
Bitcoin human talks grenoble November 2015
PDF
Deeper look into_git
PDF
Lean startupgrenoble
L'open source m'a tuer*
Summer 2017
React Native - Rex - HTGrenoble
React Fiber
De git à la blockchain
Double spending
Bitcoin human talks grenoble November 2015
Deeper look into_git
Lean startupgrenoble

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
Teaching material agriculture food technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
KodekX | Application Modernization Development
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Big Data Technologies - Introduction.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Encapsulation theory and applications.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
“AI and Expert System Decision Support & Business Intelligence Systems”
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Teaching material agriculture food technology
Understanding_Digital_Forensics_Presentation.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
KodekX | Application Modernization Development
Machine learning based COVID-19 study performance prediction
Big Data Technologies - Introduction.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Reach Out and Touch Someone: Haptics and Empathic Computing
NewMind AI Weekly Chronicles - August'25 Week I
MYSQL Presentation for SQL database connectivity
Mobile App Security Testing_ A Comprehensive Guide.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Encapsulation theory and applications.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
20250228 LYD VKU AI Blended-Learning.pptx
NewMind AI Monthly Chronicles - July 2025
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

What's new in React