Skip to content

docs: Add useOptimistic hook description to hooks reference page - #8571

Open
martinrebo wants to merge 1 commit into
reactjs:mainfrom
martinrebo:fix/missing-useOptimistic-reference-hooks
Open

docs: Add useOptimistic hook description to hooks reference page#8571
martinrebo wants to merge 1 commit into
reactjs:mainfrom
martinrebo:fix/missing-useOptimistic-reference-hooks

Conversation

@martinrebo

Copy link
Copy Markdown
Contributor

Closes #8570

📝 Description

Adds useOptimistic to the State Hooks section of the Built-in React Hooks overview page.

The hook was already documented at /reference/react/useOptimistic and listed in the left navigation menu, but was missing from the overview page, leaving it incomplete with only 17 of the 18 hooks documented.

useOptimistic is placed under State Hooks rather than Performance Hooks because its primary purpose is to manage a temporary state value during an async operation — not to optimize rendering. It works similarly to useState, holding a value that React will revert once the async action settles. The performance benefit of a snappier UI is a side effect, not the core intent.

📚 Motivation

The overview page is the main entry point for developers exploring React's built-in hooks. Having useOptimistic absent from this page means:

  • Developers new to React may not discover it exists, since the overview page is designed to be the exhaustive reference for all built-in hooks.
  • It creates an inconsistency between the sidebar navigation and the page content.
  • useOptimistic is particularly relevant in modern React apps using Server Actions and async transitions, so its visibility on the overview page is valuable for developers adopting these patterns.

✅ Changes

  • src/content/reference/react/hooks.md — added useOptimistic to the State Hooks section alongside useState and useReducer.

Testing

  • Verified the change renders correctly at http://localhost:3000/reference/react/hooks
  • Ran yarn check-all with no errors

Before

Screenshot 2026-08-02 at 11 15 28

After

Screenshot 2026-08-02 at 11 15 58

🙏 Note:

There is a stale PR #8352 that proposed creating a dedicated Async Hooks section, which would be a more permanent home for useOptimistic. This fix places it under State Hooks as the most logical interim location, and can be revisited if that proposal or a similar one moves forward.

Let me know if this should be placed in a different order, section, or if there are any copy edits needed.
🙇‍♂️ Thanks for maintaining a great developer experience with the docs!

@github-actions

github-actions Bot commented Aug 2, 2026

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

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.

[Typo]: useOptimistic is missing from Hooks reference page

1 participant