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.