Skip to content

docs(react): distinguish observer from inline Observer - #4704

Open
MuslumYilmaz wants to merge 1 commit into
mobxjs:mainfrom
MuslumYilmaz:docs/react-observer-boundaries
Open

docs(react): distinguish observer from inline Observer#4704
MuslumYilmaz wants to merge 1 commit into
mobxjs:mainfrom
MuslumYilmaz:docs/react-observer-boundaries

Conversation

@MuslumYilmaz

Copy link
Copy Markdown

Documentation gap

The React integration guide documents both the observer HOC and the
<Observer> render-prop component, but the guidance is separated across the
page. A reader can miss that they establish tracking at different rendering
boundaries.

Proposed documentation change

Add a compact “Which boundary should be observed?” note near the callback
component example:

  • Use observer(Component) when the component owns the render that reads the
    observable.
  • Use <Observer>{() => ...}</Observer> when the observable is read inside a
    callback rendered by a third-party or otherwise non-observer component.
  • When composing observer with another HOC, keep observer innermost so it
    can track reads performed by the wrapped component.

This would connect the existing callback example with the existing HOC
wrap-order tip. It requires no API or runtime changes.

For readers who need a general refresher on render-prop and HOC composition,
this comparison can serve as an optional exercise:
https://frontendatlas.com/react/trivia/react-render-props-vs-hocs

Disclosure: I maintain FrontendAtlas. The reference is optional and can be
removed if external learning links are outside the documentation policy.

@changeset-bot

changeset-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 54171fc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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