What is StaleElementReferenceException and avoid in selenium?

I got a stale reference exception. How to avoid that?

If the webdriver tries to access a web element that is currently unavailable or invalid in the DOM, the StaleElementReferenceException is thrown. This could be due to a page refresh or an element being mistakenly deleted, updated, or disconnected from the DOM.

How to avoid “StaleElementReferenceException” in Selenium?.