diff --git a/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoRefAccessInRender.ts b/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoRefAccessInRender.ts
index 7da564205475..0a08b0533c20 100644
--- a/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoRefAccessInRender.ts
+++ b/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoRefAccessInRender.ts
@@ -150,9 +150,15 @@ function collectTemporariesSidemap(fn: HIRFunction, env: Env): void {
break;
}
case 'PropertyLoad': {
+ /*
+ * Ref-typed property loads (for example props.ref) should keep their
+ * declared ref type instead of aliasing the containing object.
+ */
if (
- isUseRefType(value.object.identifier) &&
- value.property === 'current'
+ (isUseRefType(value.object.identifier) &&
+ value.property === 'current') ||
+ isUseRefType(lvalue.identifier) ||
+ isRefValueType(lvalue.identifier)
) {
continue;
}
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-props-property-access-after-ref-prop.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-props-property-access-after-ref-prop.expect.md
new file mode 100644
index 000000000000..3135cb304cc8
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-props-property-access-after-ref-prop.expect.md
@@ -0,0 +1,56 @@
+
+## Input
+
+```javascript
+// @validateRefAccessDuringRender @compilationMode:"infer"
+
+function Component(props) {
+ return (
+
+ );
+}
+
+```
+
+## Code
+
+```javascript
+import { c as _c } from "react/compiler-runtime"; // @validateRefAccessDuringRender @compilationMode:"infer"
+
+function Component(props) {
+ const $ = _c(5);
+ let t0;
+ if (
+ $[0] !== props.disabled ||
+ $[1] !== props.name ||
+ $[2] !== props.placeholder ||
+ $[3] !== props.ref
+ ) {
+ t0 = (
+
+ );
+ $[0] = props.disabled;
+ $[1] = props.name;
+ $[2] = props.placeholder;
+ $[3] = props.ref;
+ $[4] = t0;
+ } else {
+ t0 = $[4];
+ }
+ return t0;
+}
+
+```
+
+### Eval output
+(kind: exception) Fixture not implemented
\ No newline at end of file
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-props-property-access-after-ref-prop.tsx b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-props-property-access-after-ref-prop.tsx
new file mode 100644
index 000000000000..c71ab0313b23
--- /dev/null
+++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-props-property-access-after-ref-prop.tsx
@@ -0,0 +1,12 @@
+// @validateRefAccessDuringRender @compilationMode:"infer"
+
+function Component(props) {
+ return (
+
+ );
+}