Actions and modern forms

useOptimistic

Provides a temporary predicted value during an Action, based on the authoritative state.

Formal Syntax & Structure

react syntaxreact
const [view, add] = useOptimistic(items, addPending)

Working Example

Example Snippetreact
const [view, add] = useOptimistic(items, addPending)
React Reference