Skip to content

Expand FragmentInstance reference docs#8309

Open
jackpope wants to merge 7 commits intoreactjs:mainfrom
jackpope:fr-update
Open

Expand FragmentInstance reference docs#8309
jackpope wants to merge 7 commits intoreactjs:mainfrom
jackpope:fr-update

Conversation

@jackpope
Copy link
Copy Markdown
Contributor

@jackpope jackpope commented Feb 17, 2026

Preview

  • Rewrites FragmentInstance reference with per-method API docs
  • Adds scrollIntoView reference and usage example
  • Documents reactFragments DOM handle and global IntersectionObserver caching pattern
  • Fixes bugs and improves all Fragment ref usage examples

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 17, 2026

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! 🙌

Comment thread src/content/reference/react/Fragment.md Outdated

Fragment `ref`s provide `focus`, `focusLast`, and `blur` methods that operate across all DOM nodes within the Fragment:

```js {5-6}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this, and the other demos to Sandpacks?


```js
const observer = new IntersectionObserver(callback, options);
fragmentRef.current.observeUsing(observer);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this docs PR, but not sure where else to ask.

Is there a convenient way to get a list of refs from a fragment ref?
If not, this looks like something devs will find workarounds for 😄. cc @rickhanlonii might be worth reviewing this use case (and this whole post overall)

Image

https://barvian.me/react-exit-animations

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a convenient way to get a list of refs from a fragment ref?

The current design approach is to avoid coupling with specific children or parents. When the FragmentInstance handles coordination, things are more composable. You can refactor around Fragments without breaking dependent code.

Workarounds like this are possible but they put the responsibility on the user to handle edge cases. And we intentionally don't promote that pattern through a first-class API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants