What is the difference between Hot Reloading and Live Reloading in React Native?

JavascriptMobileReact Native

Javascript Problem Overview


I'm a bit confused here. When I'm debugging a React Native Application, I usually enable both Hot Reloading and Live Reloading. I want to know what is the difference between them?

Javascript Solutions


Solution 1 - Javascript

Live reloading reloads or refreshes the entire app when a file changes. For example, if you were four links deep into your navigation and saved a change, live reloading would restart the app and load the app back to the initial route.

Hot reloading only refreshes the files that were changed without losing the state of the app. For example, if you were four links deep into your navigation and saved a change to some styling, the state would not change, but the new styles would appear on the page without having to navigate back to the page you are on because you would still be on the same page.

Solution 2 - Javascript

Both can be enabled using CMD+D / CMD+CTRL+Z / Shake Gesture menu. Both are using watchman to listen to the file changes.

Live reloading reloads the entire app.

The idea behind hot reloading is to keep the app running and to inject new versions of the files that you edited at runtime. This way, you don't lose any of your state which is especially useful if you are tweaking the UI. So it reloads only that page which you change more info here

Solution 3 - Javascript

Hot Reload:

> Hot reload is used to refresh only the file in which code is change

Live Reload:

> Live Reload is used to refresh the whole app it does not concern in > which file change comes.

Solution 4 - Javascript

The difference between the two is, Live Reloading is gonna reload your entire application. It's just gonna be like, okay, the file changed, reload the entire app. Hot Reloading is not gonna reload your entire application. It's just going to patch the code that was changed and keep the state in your app.

Solution 5 - Javascript

While developing a React-Native app you need to view your code changes and for viewing code changes there are two options in React-Native.

NOTE: These two (hot reload and live relaod) features are merged in the 0.62 version of react-native as fast refresh and if you are using a version below then these two(hot reload and live reload) will be available.

You can explore this question for more information about fast refresh and hot reload https://stackoverflow.com/questions/59085281/difference-between-hot-reload-and-fast-refresh-in-react-native

1. Hot Reload

Hot reload just displays the code changes according to new code changes without restarting the app from the start and its effects only on the changed code or change will only apply to a specific component.

NOTE: Hot reload will not work sometimes if you are deep in your navigation.

2. Live Reload

Sometimes we might need Live Reload to test our code like navigation so Live reload is helpful in that case so it will reload the whole application on change in the code.

Solution 6 - Javascript

Hot reload just displays the code changes according to new code changes without restarting the app from start and it effects only on the changed code. but its good when just styling the components when adding/changing JS code it creates problems. For that Live reload or rr works good

Solution 7 - Javascript

Hot Reload: Hot reload is used to refresh only the file in which code is change Live Reload: Live Reload is used to refresh the whole app.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRaman ChoudharyView Question on Stackoverflow
Solution 1 - JavascriptNader DabitView Answer on Stackoverflow
Solution 2 - JavascriptTheCodeTalkerView Answer on Stackoverflow
Solution 3 - JavascriptsamranView Answer on Stackoverflow
Solution 4 - JavascriptIresha AmarasingheView Answer on Stackoverflow
Solution 5 - JavascriptWaheed AkhtarView Answer on Stackoverflow
Solution 6 - Javascriptuser11192787View Answer on Stackoverflow
Solution 7 - Javascriptkrishna ParekhView Answer on Stackoverflow