Best Practises In ViewModel

<h1><strong>Why do we need ViewModel?</strong></h1> <p>In Android, UI state get&rsquo;s destroyed during configuration changes like screen rotation, screen size changes etc. To persist the UI state and to access business logic, we need a plan class named ViewModel able to persist the UI state during configuration changes and process death.</p> <p>Internally, ViewModel works with activity or fragment lifecycle, it&rsquo;s doesn&rsquo;t get destroyed when activity or fragment invokes the onDestory() during configuration changes.</p> <p><a href="https://medium.com/@mukuljangir372/best-practises-in-viewmodel-e84e2bd0b678"><strong>Learn More</strong></a></p>