Try it
Counter owns the state and one local variable. React rebuilds a virtual tree in memory, compares it with the previous one, and writes only the difference to the real DOM.
Press shopName += "!" a few times. Nothing is called and the screen never changes.
Press setCount. Counter runs again and the variable starts over.
Watch the virtual DOM rebuild, produce a patch list, and hand it to the real DOM.
Switch to Step by step and press Next to move through each stage.
Press setCount. The cycle plays by itself, one stage at a time.
your functions, run during render
plain objects in memory, never painted
the browser’s tree, painted on screen
Building and comparing plain objects is cheap, and it lets React write only what differs to the real DOM. Header and Footer keep their old elements because App did not run again. ShopName, Label and Button run again because their parent did, and React.memo could skip them.