You may not like it, but React is basically Haskell. The React Compiler works for the same exact reason that compilers for pure programming languages are able to make non-trivial optimizations. If your code is composed of pure functions, it is safe to re-order their computation, or save the result for some inputs and reuse it for later for same inputs. This is not some kind of a “workaround” or a hack — it’s one of the most exciting consequences of the functional programming paradigm which has been known and used for decades. Purity and idempotency make it safe to move stuff around without changing the final outcome. Following the "rules of React" is just ensuring your code is safe to move around like this.
i think the @react.dev Compiler team could include more of this type of messaging. i'm being a bit inflammatory here (and Haskell may not the best analogy), but the principle of "pure things are safe to move around" is fundamentally simple and has been known for decades. teach it to new generation!