Is it possible to have a react native app to automatically reload in the emulator once I edit the sources and the thing recompiles itself?
You can use hot-reload in the settings for your react native app to automatically reload. you can enable hot-reloading click the "Menu" button on the sidebar inside genymotion.
UPDATE: From 0.62, React Native have added DevSettings. reload() . So, if you want to reload programmatically while developing you can use that.
If set to true, the browser will do a complete page refresh from the server and not from the cached version of the page. import React from 'react'; function App() { function refreshPage() { window. location. reload(false); } return ( <div> <button onClick={refreshPage}>Click to reload!
Hot reloading allows you to see the changes that you have made in the code without reloading your entire app. Whenever you make any changes, all you need to do is save your code. As soon as you save your code, React Native tracks which files have changed since your last saved, and only reload those file for you.
If you've created your project with react-native init
, then on the simulator, press cmd+ctrl+Z
or Hardware > Shake Gesture
and the Dev Menu will popup.
Just press Enable Live Reload
and Done! :D
EDIT : React Native team does now encourage to user Hot Reloading instead of Live Reload. More info about the difference between those two features here.
You can use hot-reload in the settings for your react native app to automatically reload. you can enable hot-reloading click the "Menu" button on the sidebar inside genymotion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With