Skip to content

Clarify how cloneElement preserves and overrides refs - #8764

Open
smg99 wants to merge 1 commit into
reactjs:mainfrom
smg99:docs/clone-element-ref-override
Open

smg99 wants to merge 1 commit into
reactjs:mainfrom
smg99:docs/clone-element-ref-override

Conversation

@smg99

@smg99 smg99 commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Clarify how to preserve, replace, or clear a ref when cloning an element. In React 19, the resulting ref is available at clonedElement.props.ref.

Verified against React 19.0.0. Omitted and undefined ref overrides preserved the existing ref, null cleared it, and a supplied ref replaced it. The original element retained its ref.

@github-actions

Copy link
Copy Markdown

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

This branch was successfully deployed

1 active deployment
Preview — c5d6e2dd Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant