[rcr] Re-export useMemoCache in top level React namespace (#31139)
In order to support using the compiler on versions of React prior to 19, we need the ability to statically import `c` (aka useMemoCache) or fallback to a polyfill supplied by `react-compiler-runtime` (note: this is a separate npm package, not to be confused with `react/compiler-runtime`, which is currently a part of react). To do this we first need to re-export `useMemoCache` under the top level React namespace again, which is additive and thus non-breaking. Doing so allows `react-compiler-runtime` to statically either re-export `React.__COMPILER_RUNTIME.c` or supply a polyfill, without the need for a dynamic import which is finicky to support due to returning a promise. In later PRs I will remove `react/compiler-runtime` and update the compiler to emit imports to `react-compiler-runtime` instead.
L
lauren committed
b78a7f2f35e554a8647c3262d7f392e68d06febc
Parent: 68d59d4
Committed by GitHub <noreply@github.com>
on 10/7/2024, 8:25:04 PM