---
source: https://iinventedlight.com/library/notes/react-useoptimistic.md
title: "React useOptimistic: show an update before it finishes"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (React docs); CC-BY-4.0 (reactjs/react.dev); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: React docs, useOptimistic; reactjs/react.dev, useOptimistic.md. CC-BY-4.0 (https://raw.githubusercontent.com/reactjs/react.dev/main/LICENSE-DOCS.md). Copyright Meta Platforms, Inc. and affiliates."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: react useOptimistic"
tags: [react, useOptimistic, hooks, actions, transitions]
client: Librarian
sources:
  - id: S1
    title: "useOptimistic"
    publisher: React docs
    url: https://react.dev/reference/react/useOptimistic
    accessed: 2026-11-18
    license: "CC-BY-4.0"
  - id: S2
    title: "useOptimistic.md"
    publisher: reactjs/react.dev
    url: https://github.com/reactjs/react.dev/blob/main/src/content/reference/react/useOptimistic.md
    accessed: 2026-11-18
    license: "CC-BY-4.0"
---
# React useOptimistic: show an update before it finishes
**Answer:** useOptimistic is a React Hook that lets you optimistically update the UI. The first argument is the value returned when there are no pending Actions. An optional reducer function specifies how the optimistic state is computed from the current state and an action.

## Examples

```js
import { useOptimistic } from 'react';

function Form({ message }) {
  const [optimistic, addOptimistic] = useOptimistic(message, (current, next) => next);
  return <button onClick={() => addOptimistic("saved")}>Save</button>;
}
```

## Notes

 You can pass the next state directly, or compute it in the reducer. 

## Reference list

- `useOptimistic` lets you optimistically update the UI.
- `The` first value is used when there are no pending Actions.
- `optional` An optional reducer specifies how the optimistic state is computed.

## See also

- [react-state](https://iinventedlight.com/library/notes/react-state/)
- [react-effects](https://iinventedlight.com/library/notes/react-effects/)
- [react-components-basics](https://iinventedlight.com/library/notes/react-components-basics/)

## Claims

- id: C1
  claim: useOptimistic lets you optimistically update the UI.
  source: S1
  evidence: "useOptimistic is a React Hook that lets you optimistically update the UI"

- id: C2
  claim: The first value is used when there are no pending Actions.
  source: S2
  evidence: "The value returned when there are no pending Actions"

- id: C3
  claim: An optional reducer specifies how the optimistic state is computed.
  source: S2
  evidence: "The reducer function that specifies how the optimistic"

## Sources

- [S1] useOptimistic. React docs. https://react.dev/reference/react/useOptimistic . License: CC-BY-4.0. Accessed 2026-11-18.

- [S2] useOptimistic.md. reactjs/react.dev. https://github.com/reactjs/react.dev/blob/main/src/content/reference/react/useOptimistic.md . License: CC-BY-4.0. Accessed 2026-11-18.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: React docs, useOptimistic; reactjs/react.dev, useOptimistic.md. CC-BY-4.0 (https://raw.githubusercontent.com/reactjs/react.dev/main/LICENSE-DOCS.md). Copyright Meta Platforms, Inc. and affiliates. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
