The DOM is basically the content on the screen. It will rerender and run the code from top down inside a component every time the screen changes.

For example, scrolling on a screen will change the dom

The DOM doesn’t rerender when values (state) changes. This is important in knowing how to memoize/ cache information.

Here the code ‘pagination changed’ only runs when the search prop changes. NOT when the dom re renders. this is because it’s outside the component and the const pagainationsummaryselector doesn’t run when the DOM reloads.

DOM LOADED AGAIN changes and redefines everything when the dom reloads.

This is so cool.