SlideShare a Scribd company logo
Hot Reloading with React –
Experiences
Heribert Schütz
webXcerpt Software GmbH
hs@webxcerpt.com, www.webxcerpt.com
ReactJS Usergroup Munich, 2015-10-08
Hot Reloading
Development utility:
● Load new code versions, ...
● … but keep your application state.
Dan Abramov at React Europe 2015
● „Live React“
● Hot reloading
● Time travel
● Redux
● https://www.youtube.com/watch?v=xsSnOQynTHs
Hot Reloading for React
● github.com/gaearon/react-hot-loader
– @gaearon = Dan Abramov
– react-hot-loader is deprecated.
● Instead use
github.com/gaearon/react-transform-boilerplate.
● No Redux needed!
Demo
react-transform-boilerplate
Make Your React App Hot-
Reloadable in 5 Simple Steps
1. git clone git@github.com:gaearon/
react-transform-boilerplate.git
2. Make your own project configuration look similar.
(You're anyway using webpack and babel, aren't you?)
3. npm start
4. Point your browser to localhost:3000
Make Your React App Hot-
Reloadable in 5 Simple Steps
5. Figure out why it doesn't work.
– Does your server process crash or report an error?
– Does your server run, but your app doesn't work?
– Does your app run, but doesn't auto-reload?
(I got stuck here.)
– Does your app auto-reload but loses the state?
– ...
A Different Approach:
Persist App State in the Browser
● Store your state upon each update in
localStorage or indexedDB.
● Retrieve that state upon app startup
and use it as the initial state.
● You might want that anyway.
● Or you just enable it for debugging.
Persisting App State with Redux
(DIY Version)
const persistMiddleware = key =>
({getState}) => next => action => {
const result = next(action);
localStorage.setItem(
key, JSON.stringify(getState())
);
return result;
};
const getInitialState =
key => localStorage.getItem(key);
Persisting App State with Redux
(Toolkit Version)
● Use github.com/gaearon/redux-devtools as a
dev-dependency.
● Use "store enhancer" persistState(...).
● Append „?debug_session=session_key“ to
URL.
● Hit "Commit" in the side bar to actually store.
● Try it with github.com/hcschuetz/15-puzzle.
Demo
redux-devtools
Summary: My Experience
● React/babel/webpack-based approach
(react-transform-boilerplate)
– Very cool idea
– Does not require Redux
– Was hairy for me
● Redux/localStorage-based approaches
(DIY and redux-devtools)
– Worked reliably
– Easy to understand

More Related Content

What's hot

Hot deploy
Hot deployHot deploy
Hot deploy
Arief Warazuhudien
 
iOS Indie Developer Toolkit - CocoaHeads 3city
iOS Indie Developer Toolkit - CocoaHeads 3cityiOS Indie Developer Toolkit - CocoaHeads 3city
iOS Indie Developer Toolkit - CocoaHeads 3city
Michał Zygar
 
Monitoring at a SAAS Startup: Tradeoffs and Tools
Monitoring at a SAAS Startup: Tradeoffs and ToolsMonitoring at a SAAS Startup: Tradeoffs and Tools
Monitoring at a SAAS Startup: Tradeoffs and Tools
bridgetkromhout
 
Om & React
Om & ReactOm & React
Om & React
Fredrik Dyrkell
 
From a native app to a webapp using Node.js and emscripten
From a native app to a webapp using Node.js and emscriptenFrom a native app to a webapp using Node.js and emscripten
From a native app to a webapp using Node.js and emscripten
Florian Rival
 
2013-03-07 indie developer toolkit
2013-03-07 indie developer toolkit2013-03-07 indie developer toolkit
2013-03-07 indie developer toolkit
CocoaHeads Tricity
 
Introduction to DevOps with Visual Studio Team Services -.Net Conf Mx 2018
Introduction to DevOps with Visual Studio Team Services -.Net Conf Mx 2018Introduction to DevOps with Visual Studio Team Services -.Net Conf Mx 2018
Introduction to DevOps with Visual Studio Team Services -.Net Conf Mx 2018
Vicente Gerardo Guzman Lucio
 
DevOps for Hackathons: DevOps without the Ops
DevOps for Hackathons: DevOps without the OpsDevOps for Hackathons: DevOps without the Ops
DevOps for Hackathons: DevOps without the Ops
Or Rosenblatt
 
Eclipse Mars News @JUG HH
Eclipse Mars News @JUG HHEclipse Mars News @JUG HH
Eclipse Mars News @JUG HH
simonscholz
 
The gitflow way
The gitflow wayThe gitflow way
The gitflow way
Ruijun Li
 
Visual Studio App Center: React Native A/B Testing
Visual Studio App Center: React Native A/B TestingVisual Studio App Center: React Native A/B Testing
Visual Studio App Center: React Native A/B Testing
John M. Wargo
 
Automating WordPress Plugin Development with Gulp
Automating WordPress Plugin Development with GulpAutomating WordPress Plugin Development with Gulp
Automating WordPress Plugin Development with Gulp
Mike Hale
 
Using Web Software Architecture in Traditional Desktop App Development
Using Web Software Architecture in Traditional Desktop App DevelopmentUsing Web Software Architecture in Traditional Desktop App Development
Using Web Software Architecture in Traditional Desktop App Development
Ben Lau
 
coursecompletion
coursecompletioncoursecompletion
coursecompletion
Ivan Petrovic
 
Steps to deploy mule application with munit on cloudhub using jenkins pipeline
Steps to deploy mule application with munit on cloudhub using jenkins pipelineSteps to deploy mule application with munit on cloudhub using jenkins pipeline
Steps to deploy mule application with munit on cloudhub using jenkins pipeline
AmitSrivastava414
 
How to outsource the pain of drupal translation to smartling from loparev
How to outsource the pain of drupal translation to smartling from loparevHow to outsource the pain of drupal translation to smartling from loparev
How to outsource the pain of drupal translation to smartling from loparev
Oleksii Bogush
 
Heroku and Rails Applications
Heroku and Rails ApplicationsHeroku and Rails Applications
Heroku and Rails Applications
Andreas Sotnik
 
Docker 101 - From production to development
Docker 101 - From production to developmentDocker 101 - From production to development
Docker 101 - From production to development
Raül Pérez
 
Grunt training deck
Grunt training deckGrunt training deck
Grunt training deck
James Ford
 
Henge
HengeHenge

What's hot (20)

Hot deploy
Hot deployHot deploy
Hot deploy
 
iOS Indie Developer Toolkit - CocoaHeads 3city
iOS Indie Developer Toolkit - CocoaHeads 3cityiOS Indie Developer Toolkit - CocoaHeads 3city
iOS Indie Developer Toolkit - CocoaHeads 3city
 
Monitoring at a SAAS Startup: Tradeoffs and Tools
Monitoring at a SAAS Startup: Tradeoffs and ToolsMonitoring at a SAAS Startup: Tradeoffs and Tools
Monitoring at a SAAS Startup: Tradeoffs and Tools
 
Om & React
Om & ReactOm & React
Om & React
 
From a native app to a webapp using Node.js and emscripten
From a native app to a webapp using Node.js and emscriptenFrom a native app to a webapp using Node.js and emscripten
From a native app to a webapp using Node.js and emscripten
 
2013-03-07 indie developer toolkit
2013-03-07 indie developer toolkit2013-03-07 indie developer toolkit
2013-03-07 indie developer toolkit
 
Introduction to DevOps with Visual Studio Team Services -.Net Conf Mx 2018
Introduction to DevOps with Visual Studio Team Services -.Net Conf Mx 2018Introduction to DevOps with Visual Studio Team Services -.Net Conf Mx 2018
Introduction to DevOps with Visual Studio Team Services -.Net Conf Mx 2018
 
DevOps for Hackathons: DevOps without the Ops
DevOps for Hackathons: DevOps without the OpsDevOps for Hackathons: DevOps without the Ops
DevOps for Hackathons: DevOps without the Ops
 
Eclipse Mars News @JUG HH
Eclipse Mars News @JUG HHEclipse Mars News @JUG HH
Eclipse Mars News @JUG HH
 
The gitflow way
The gitflow wayThe gitflow way
The gitflow way
 
Visual Studio App Center: React Native A/B Testing
Visual Studio App Center: React Native A/B TestingVisual Studio App Center: React Native A/B Testing
Visual Studio App Center: React Native A/B Testing
 
Automating WordPress Plugin Development with Gulp
Automating WordPress Plugin Development with GulpAutomating WordPress Plugin Development with Gulp
Automating WordPress Plugin Development with Gulp
 
Using Web Software Architecture in Traditional Desktop App Development
Using Web Software Architecture in Traditional Desktop App DevelopmentUsing Web Software Architecture in Traditional Desktop App Development
Using Web Software Architecture in Traditional Desktop App Development
 
coursecompletion
coursecompletioncoursecompletion
coursecompletion
 
Steps to deploy mule application with munit on cloudhub using jenkins pipeline
Steps to deploy mule application with munit on cloudhub using jenkins pipelineSteps to deploy mule application with munit on cloudhub using jenkins pipeline
Steps to deploy mule application with munit on cloudhub using jenkins pipeline
 
How to outsource the pain of drupal translation to smartling from loparev
How to outsource the pain of drupal translation to smartling from loparevHow to outsource the pain of drupal translation to smartling from loparev
How to outsource the pain of drupal translation to smartling from loparev
 
Heroku and Rails Applications
Heroku and Rails ApplicationsHeroku and Rails Applications
Heroku and Rails Applications
 
Docker 101 - From production to development
Docker 101 - From production to developmentDocker 101 - From production to development
Docker 101 - From production to development
 
Grunt training deck
Grunt training deckGrunt training deck
Grunt training deck
 
Henge
HengeHenge
Henge
 

Viewers also liked

Productive development with react js
Productive development with react jsProductive development with react js
Productive development with react js
Tim (dev-tim) Zadorozhniy
 
Opal-hot-reloader
Opal-hot-reloaderOpal-hot-reloader
Opal-hot-reloader
Forrest Chang
 
Scala for curious
Scala for curiousScala for curious
Scala for curious
Tim (dev-tim) Zadorozhniy
 
Loaders (and why we should use them)
Loaders (and why we should use them)Loaders (and why we should use them)
Loaders (and why we should use them)
Michael Pustovit
 
Webpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JSWebpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JS
Emil Öberg
 
Introduction to loaders
Introduction to loadersIntroduction to loaders
Introduction to loaders
Tech_MX
 
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
Barry Feldman
 

Viewers also liked (7)

Productive development with react js
Productive development with react jsProductive development with react js
Productive development with react js
 
Opal-hot-reloader
Opal-hot-reloaderOpal-hot-reloader
Opal-hot-reloader
 
Scala for curious
Scala for curiousScala for curious
Scala for curious
 
Loaders (and why we should use them)
Loaders (and why we should use them)Loaders (and why we should use them)
Loaders (and why we should use them)
 
Webpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JSWebpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JS
 
Introduction to loaders
Introduction to loadersIntroduction to loaders
Introduction to loaders
 
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
 

Similar to Hot Reloading with React - Experiences

SaaS Boilerplate.pptx
SaaS Boilerplate.pptxSaaS Boilerplate.pptx
SaaS Boilerplate.pptx
DuyKhi8
 
Matteo Manchi - React Native for multi-platform mobile applications - Codemot...
Matteo Manchi - React Native for multi-platform mobile applications - Codemot...Matteo Manchi - React Native for multi-platform mobile applications - Codemot...
Matteo Manchi - React Native for multi-platform mobile applications - Codemot...
Codemotion
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications
Concetto Labs
 
Cross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkitCross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkit
Wittawas Wisarnkanchana
 
High Productivity Web Development Workflow
High Productivity Web Development WorkflowHigh Productivity Web Development Workflow
High Productivity Web Development Workflow
Vũ Nguyễn
 
High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014
Oliver N
 
React native
React nativeReact native
React native
Vikrant Negi
 
DevOps Workshop Part 1
DevOps Workshop Part 1DevOps Workshop Part 1
DevOps Workshop Part 1
GDSC UofT Mississauga
 
Introduzione a React Native - Facebook Developer Circle Rome
Introduzione a React Native - Facebook Developer Circle RomeIntroduzione a React Native - Facebook Developer Circle Rome
Introduzione a React Native - Facebook Developer Circle Rome
Matteo Manchi
 
Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular application
Suresh Patidar
 
Ultimate Survival - React-Native edition
Ultimate Survival - React-Native editionUltimate Survival - React-Native edition
Ultimate Survival - React-Native edition
Richard Radics
 
Developing, building, testing and deploying react native apps
Developing, building, testing and deploying react native appsDeveloping, building, testing and deploying react native apps
Developing, building, testing and deploying react native apps
Leena N
 
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
MarcinStachniuk
 
AngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue SolutionsAngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue Solutions
RapidValue
 
Intro to Github Actions @likecoin
Intro to Github Actions @likecoinIntro to Github Actions @likecoin
Intro to Github Actions @likecoin
William Chong
 
M365 global developer bootcamp 2019 PA
M365 global developer bootcamp 2019  PAM365 global developer bootcamp 2019  PA
M365 global developer bootcamp 2019 PA
Thomas Daly
 
M365 global developer bootcamp 2019
M365 global developer bootcamp 2019M365 global developer bootcamp 2019
M365 global developer bootcamp 2019
Thomas Daly
 
3DC Intro to Git Workshop
3DC Intro to Git Workshop3DC Intro to Git Workshop
3DC Intro to Git Workshop
BeckhamWee
 
Introducing the new "react-native upgrade"
Introducing the new "react-native upgrade"Introducing the new "react-native upgrade"
Introducing the new "react-native upgrade"
Nicolas Cuillery
 
One code Web, iOS, Android
One code Web, iOS, AndroidOne code Web, iOS, Android
One code Web, iOS, Android
Artem Marchenko
 

Similar to Hot Reloading with React - Experiences (20)

SaaS Boilerplate.pptx
SaaS Boilerplate.pptxSaaS Boilerplate.pptx
SaaS Boilerplate.pptx
 
Matteo Manchi - React Native for multi-platform mobile applications - Codemot...
Matteo Manchi - React Native for multi-platform mobile applications - Codemot...Matteo Manchi - React Native for multi-platform mobile applications - Codemot...
Matteo Manchi - React Native for multi-platform mobile applications - Codemot...
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications
 
Cross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkitCross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkit
 
High Productivity Web Development Workflow
High Productivity Web Development WorkflowHigh Productivity Web Development Workflow
High Productivity Web Development Workflow
 
High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014
 
React native
React nativeReact native
React native
 
DevOps Workshop Part 1
DevOps Workshop Part 1DevOps Workshop Part 1
DevOps Workshop Part 1
 
Introduzione a React Native - Facebook Developer Circle Rome
Introduzione a React Native - Facebook Developer Circle RomeIntroduzione a React Native - Facebook Developer Circle Rome
Introduzione a React Native - Facebook Developer Circle Rome
 
Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular application
 
Ultimate Survival - React-Native edition
Ultimate Survival - React-Native editionUltimate Survival - React-Native edition
Ultimate Survival - React-Native edition
 
Developing, building, testing and deploying react native apps
Developing, building, testing and deploying react native appsDeveloping, building, testing and deploying react native apps
Developing, building, testing and deploying react native apps
 
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
 
AngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue SolutionsAngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue Solutions
 
Intro to Github Actions @likecoin
Intro to Github Actions @likecoinIntro to Github Actions @likecoin
Intro to Github Actions @likecoin
 
M365 global developer bootcamp 2019 PA
M365 global developer bootcamp 2019  PAM365 global developer bootcamp 2019  PA
M365 global developer bootcamp 2019 PA
 
M365 global developer bootcamp 2019
M365 global developer bootcamp 2019M365 global developer bootcamp 2019
M365 global developer bootcamp 2019
 
3DC Intro to Git Workshop
3DC Intro to Git Workshop3DC Intro to Git Workshop
3DC Intro to Git Workshop
 
Introducing the new "react-native upgrade"
Introducing the new "react-native upgrade"Introducing the new "react-native upgrade"
Introducing the new "react-native upgrade"
 
One code Web, iOS, Android
One code Web, iOS, AndroidOne code Web, iOS, Android
One code Web, iOS, Android
 

Recently uploaded

みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 

Recently uploaded (20)

みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 

Hot Reloading with React - Experiences

  • 1. Hot Reloading with React – Experiences Heribert Schütz webXcerpt Software GmbH hs@webxcerpt.com, www.webxcerpt.com ReactJS Usergroup Munich, 2015-10-08
  • 2. Hot Reloading Development utility: ● Load new code versions, ... ● … but keep your application state.
  • 3. Dan Abramov at React Europe 2015 ● „Live React“ ● Hot reloading ● Time travel ● Redux ● https://www.youtube.com/watch?v=xsSnOQynTHs
  • 4. Hot Reloading for React ● github.com/gaearon/react-hot-loader – @gaearon = Dan Abramov – react-hot-loader is deprecated. ● Instead use github.com/gaearon/react-transform-boilerplate. ● No Redux needed!
  • 6. Make Your React App Hot- Reloadable in 5 Simple Steps 1. git clone git@github.com:gaearon/ react-transform-boilerplate.git 2. Make your own project configuration look similar. (You're anyway using webpack and babel, aren't you?) 3. npm start 4. Point your browser to localhost:3000
  • 7. Make Your React App Hot- Reloadable in 5 Simple Steps 5. Figure out why it doesn't work. – Does your server process crash or report an error? – Does your server run, but your app doesn't work? – Does your app run, but doesn't auto-reload? (I got stuck here.) – Does your app auto-reload but loses the state? – ...
  • 8. A Different Approach: Persist App State in the Browser ● Store your state upon each update in localStorage or indexedDB. ● Retrieve that state upon app startup and use it as the initial state. ● You might want that anyway. ● Or you just enable it for debugging.
  • 9. Persisting App State with Redux (DIY Version) const persistMiddleware = key => ({getState}) => next => action => { const result = next(action); localStorage.setItem( key, JSON.stringify(getState()) ); return result; }; const getInitialState = key => localStorage.getItem(key);
  • 10. Persisting App State with Redux (Toolkit Version) ● Use github.com/gaearon/redux-devtools as a dev-dependency. ● Use "store enhancer" persistState(...). ● Append „?debug_session=session_key“ to URL. ● Hit "Commit" in the side bar to actually store. ● Try it with github.com/hcschuetz/15-puzzle.
  • 12. Summary: My Experience ● React/babel/webpack-based approach (react-transform-boilerplate) – Very cool idea – Does not require Redux – Was hairy for me ● Redux/localStorage-based approaches (DIY and redux-devtools) – Worked reliably – Easy to understand