DEV Community

MJ Abadilla
MJ Abadilla

Posted on • Edited on

3 2

React Native cleanup practices that will keep you sane.

All of the commands here can be executed separately. Don't be afraid to clean up your React Native project every once in a while of or when something unexpected happens.

Doing a good cleanup first often saves the trouble of filing an issue ticket and waiting for someone else to suggest that you reinstall the app.. etc.

What the scripts will do?

  1. Cleanup react dependencies and cache

  2. Cleanup metro bundler cache and files

  3. Cleanup react-native haste cache references

  4. Cleanup ios and android files

  5. Always reset cache when using npm start

  6. Optionally run script file after every package installation

  7. Run pod install after every package installation

How to use:

Don't forget to close all Metrobundler (or the like) instances first before running. A killpackager script is added to start a close and new instance every npm start
Close all emulators or simulators
run cleanup:all and take a break

See the code here:

React Native cleanup scripts

What if the errors are not fixed?

Go and read the error logs and ask the community if you need to. Use the repository issue tracker or stackoverflow

Sentry mobile image

Mobile Vitals: A first step to Faster Apps

Slow startup times, UI hangs, and frozen frames frustrate users—but they’re also fixable. Mobile Vitals help you measure and understand these performance issues so you can optimize your app’s speed and responsiveness. Learn how to use them to reduce friction and improve user experience.

Read the guide →

Top comments (0)

Sentry mobile image

Improving mobile performance, from slow screens to app start time

Based on our experience working with thousands of mobile developer teams, we developed a mobile monitoring maturity curve.

Read more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay