You make it explicit in the system. I don't use React, but I do dabble with functional reactive programming. In an FRP system, you define a directed acyclic graph of values, where the edges are dependencies from one value to another. So, when an event enters the system at one of the graph's roots, only the things that depend on it will be updated.
Furthermore, you can avoid unnecessary re-computation via the usual techniques like memoization. One of the big advantages of the "virtual DOM" is that we get to build documents using a real programming language, not some HTML templating system.
What? It's no different than saying which inputs are passed to a function. Also, languages with macros can add some nice syntactical sugar on top. JavaScript, of course, doesn't have a macro system so there's not much we can do there in that regard.
Furthermore, you can avoid unnecessary re-computation via the usual techniques like memoization. One of the big advantages of the "virtual DOM" is that we get to build documents using a real programming language, not some HTML templating system.