What is the purpose of the flag –reset-cache in react-native start command

Issue

I am curious about this flag because since I’ve started building apps using react native I have been using it, without any clue what it really is.

Solution

See when you do yarn start or npm start or react-native start

what it does is it starts the Metro bundler, builds a JS bundle , uses that in the app .

When you do yarn start –reset-cache or whatever command you use to start your app. it resets the JS bundle by bundling again.

So sometimes what happens is you add some code in JS layer and when debugging you cant see console.logs etc, but reset-cache ensures that latest JS bundle is taken 🙂

Hope it helps

You can see in the picture below, it says cache was reset
enter image description here

Answered By – Gaurav Roy

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published