---
title: Optimistic UI
type: guide
summary: Optimistic UI updates with SWR mutation.
---

# Optimistic UI



<iframe
  src="https://codesandbox.io/embed/swr-basic-forked-gry7m0?fontsize=14&hidenavigation=1&theme=dark"
  style={{
  width: '100%',
  height: '100%',
  border: 0,
  overflow: 'hidden',
  background: 'rgb(21, 21, 21)'
}}
  title="SWR - Optimistic UI"
  allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
  sandbox="allow-autoplay allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
/>


---

For a semantic overview of all documentation, see [/sitemap.md](/sitemap.md)

For an index of all available documentation, see [/llms.txt](/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/agents.md](/agents.md)