i'd want to correct this a bit — the compiler actually emits optimizations that are impossible to do by hand because unlike useMemo/useCallback, the compiler-backed cache works with conditions. i'd recommend playing with playground.react.dev and reading the compiler output