useOptimistic for Optimistic UI in Next.js Server Actions (+ Revalidate)

ByteGrad July 25, 2023
Video Thumbnail
ByteGrad Logo

ByteGrad

@bytegrad

About

Hi, I'm Wesley. I'm a brand ambassador for Kinde (paid sponsorship). My COMPLETE React & Next.js course is out now! Find it here: https://bytegrad.com/courses/professional-react-nextjs It's the #1 resource to master the latest React & Next.js. I'm very proud of it, my best work! Interested in sponsoring me? I love working with sponsors. Please email me here: [email protected] Note that my videos may contain mistakes. Always verify yourself that your code is safe and does what you want it to do for your specific situation. You agree by watching the videos that you are solely responsible for any mistakes in your code. This channel and all its content is owned & operated by ByteGrad Sp. z o.o. with Tax ID: PL6762676561 and KRS-number: 0001125554

Video Description

👉 NEW React & Next.js Course: https://bytegrad.com/courses/professional-react-nextjs Optimistic UI in Next.js is now possible! Hi, I'm Wesley. I'm a brand ambassador for Kinde (paid sponsorship). 👉 Add authentication to your app FAST: https://bit.ly/3QOe1Bh 👉 NEW React & Next.js Course: https://bytegrad.com/courses/professional-react-nextjs 👉 Professional JavaScript Course: https://bytegrad.com/courses/professional-javascript 👉 Professional CSS Course: https://bytegrad.com/courses/professional-css 👉 Discord: all my courses have a private Discord where I actively participate 🔔 Email newsletter (BIG update soon): https://email.bytegrad.com ⏱️ Timestamps: 0:00 Optimistic UI example 0:42 Overview 2:01 useOptimistic hook 5:41 Revert / Undo (revalidatePath) #webdevelopment #programming #coding . . TOP resource to LEARN AI for Developers - https://datacamp.pxf.io/RGyxrR (paid sponsorship & ByteGrad Sp. z o.o. gets commission)

Upgrade Your Gaming Setup Now

AI-recommended products based on this video

Loading...
Beelink SER3 Mini Desktop PC with AMD Ryzen 3 3200U 2C/4T, 16GB DDR4 500GB PCIE3.0 X4 SSD, Dual Display Output, WiFi6/BT5.2 W-11 Pro Mini Gaming Computer

Beelink SER3 Mini Desktop PC with AMD Ryzen 3 3200U 2C/4T, 16GB DDR4 500GB PCIE3.0 X4 SSD, Dual Display Output, WiFi6/BT5.2 W-11 Pro Mini Gaming Computer

(239)
$459.00
FREE delivery Sat, Jan 3
Loading...
Beelink SER3 Mini PC, AMD Ryzen 3 3200U(14nm, 2C/4T) up to 3.5GHz, Mini Gaming Computer 16GB DDR4 RAM 500GB PCIE3.0 X4 SSD, Micro PC 4K@60Hz Dual Display, Mini Computer WiFi6/BT5.2/HTPC/W-11 Pro

Beelink SER3 Mini PC, AMD Ryzen 3 3200U(14nm, 2C/4T) up to 3.5GHz, Mini Gaming Computer 16GB DDR4 RAM 500GB PCIE3.0 X4 SSD, Micro PC 4K@60Hz Dual Display, Mini Computer WiFi6/BT5.2/HTPC/W-11 Pro

(1,251)
$329.00
FREE delivery Sat, Jan 3
Loading...
Beelink SER3 Mini PC, AMD Ryzen 3 3200U(up to 3.5GHz) 2C/4T, Mini Computer 16GB DDR4 RAM 500GB SSD, Mini Desktop Computer 4K@60Hz Dual HDMI Display WiFi6/BT5.2/WOL/HTPC/W-11 Pro

Beelink SER3 Mini PC, AMD Ryzen 3 3200U(up to 3.5GHz) 2C/4T, Mini Computer 16GB DDR4 RAM 500GB SSD, Mini Desktop Computer 4K@60Hz Dual HDMI Display WiFi6/BT5.2/WOL/HTPC/W-11 Pro

(815)
$329.00
FREE delivery Sat, Jan 3
50+ bought in past month
Loading...
acer Aspire 3 A315-24P-R7VH, 15.6" FHD 1920x1080 Laptop, AMD Ryzen 3 7320U, Radeon Graphics, 8GB RAM, 128G SSD, Windows 11 in S Mode
Best Seller

acer Aspire 3 A315-24P-R7VH, 15.6" FHD 1920x1080 Laptop, AMD Ryzen 3 7320U, Radeon Graphics, 8GB RAM, 128G SSD, Windows 11 in S Mode

(3,603)
$529.99$489.99
FREE delivery Tue, Jun 17
500+ bought in past month
Loading...
Gaming Mini PC N2 Pro, Ryzen 7 6800H, 32GB DDR5 512GB M.2 NVME SSD, Radeon 680M Mini Computers, Uual USB4 8K UHD, Quad Display, WiFi 6E, BT-5.2, Mini Desktop PC/11 Pro/Office

Gaming Mini PC N2 Pro, Ryzen 7 6800H, 32GB DDR5 512GB M.2 NVME SSD, Radeon 680M Mini Computers, Uual USB4 8K UHD, Quad Display, WiFi 6E, BT-5.2, Mini Desktop PC/11 Pro/Office

(56)
$589.99
FREE delivery Sat, Jan 3
Loading...
MSI Codex Z2 Gaming Desktop: AMD R7-8700F, GeForce RTX 5070, 32GB DDR5, 2TB m.2 NVMe SSD, USB Type-C, VR-Ready, Windows 11 Home : A8NVP-436US

MSI Codex Z2 Gaming Desktop: AMD R7-8700F, GeForce RTX 5070, 32GB DDR5, 2TB m.2 NVMe SSD, USB Type-C, VR-Ready, Windows 11 Home : A8NVP-436US

(124)
$2,099.00
FREE delivery Mon, Feb 9
Loading...
BOSGAME P3 Lite Mini PC, AMD Ryzen 7 6800H Mini Computer (8C/16T, up to 4.7GHz), 24GB DDR4 1TB M.2 NVMe SSD, Triple Display Desktop Gaming PC, Pre-in Win 11 Pro, Dual LAN, WiFi 6E, BT 5.2

BOSGAME P3 Lite Mini PC, AMD Ryzen 7 6800H Mini Computer (8C/16T, up to 4.7GHz), 24GB DDR4 1TB M.2 NVMe SSD, Triple Display Desktop Gaming PC, Pre-in Win 11 Pro, Dual LAN, WiFi 6E, BT 5.2

(67)
$549.00
FREE delivery Sun, Aug 10
Loading...
ORIGIMAGIC N1 Mini PC, Ryzen 7 5825U(8C/16T, UP to 4.5GHz) 32GB RAM 1TB M.2 NVMe SSD, Mini Computer 4K Quad Display/Dual USB-C(Support Data/PD3.0/DP) /WiFi 6E/BT5.2, Light Gaming/Office

ORIGIMAGIC N1 Mini PC, Ryzen 7 5825U(8C/16T, UP to 4.5GHz) 32GB RAM 1TB M.2 NVMe SSD, Mini Computer 4K Quad Display/Dual USB-C(Support Data/PD3.0/DP) /WiFi 6E/BT5.2, Light Gaming/Office

(33)
$589.99
FREE delivery Sun, Aug 10
Loading...
Corsair Vengeance LPX 32GB (2 X 16GB) DDR4 3200 (PC4-25600) C16 1.35V Desktop Memory - Black
Best Seller

Corsair Vengeance LPX 32GB (2 X 16GB) DDR4 3200 (PC4-25600) C16 1.35V Desktop Memory - Black

(16,675)
$112.99$101.69
FREE delivery Sun, Aug 10
500+ bought in past month
Loading...
2PCS 95mm 7PIN T129215SU FDC10U12S9-C 12V 0.5A RTX3070 3060Ti Graphic Card Cooler Fan for ASUS GeForce RTX 3060 Ti 3070 Dual OC Fan

2PCS 95mm 7PIN T129215SU FDC10U12S9-C 12V 0.5A RTX3070 3060Ti Graphic Card Cooler Fan for ASUS GeForce RTX 3060 Ti 3070 Dual OC Fan

(4)
$46.40$46.00
FREE delivery Feb 19 - 20
Loading...
87MM FDC10U12S9-C for Cooling Fan for ASUS for GeForce RTX 2080 2070 2060 Dual for Advanced OC for Gaming Graphics Card Cooler(Black B-Fan)

87MM FDC10U12S9-C for Cooling Fan for ASUS for GeForce RTX 2080 2070 2060 Dual for Advanced OC for Gaming Graphics Card Cooler(Black B-Fan)

(0)
$23.22
FREE delivery Mar 19 - Apr 10
Loading...
Asus Prime GeForce RTX 5080 16GB GDDR7 Prime-RTX5080-16G Pci-Express 5.0 Dlss 4.0 Graphics Card Gaming

Asus Prime GeForce RTX 5080 16GB GDDR7 Prime-RTX5080-16G Pci-Express 5.0 Dlss 4.0 Graphics Card Gaming

(543)
$1,809.99
FREE delivery Thu, Feb 19
Loading...
The SFF-Ready ASUS Prime GeForce RTX™ 5070 12GB GDDR7 White OC Edition Graphics Card (PCIe® 5.0, 12GB GDDR7, HDMI®/DP 2.1, 2.5-Slot, Axial-tech Fans, Dual BIOS)

The SFF-Ready ASUS Prime GeForce RTX™ 5070 12GB GDDR7 White OC Edition Graphics Card (PCIe® 5.0, 12GB GDDR7, HDMI®/DP 2.1, 2.5-Slot, Axial-tech Fans, Dual BIOS)

(670)
$909.99
FREE delivery Sat, Jan 3
50+ bought in past month
Loading...
CeraVe AM Face Moisturizer SPF 50, Facial Moisturizing Lotion with Sunscreen, Hyaluronic Acid & Niacinamide, Broad Spectrum UVA+UVB Protection, No White Cast, Recommended by Dermatologists, 89mL

CeraVe AM Face Moisturizer SPF 50, Facial Moisturizing Lotion with Sunscreen, Hyaluronic Acid & Niacinamide, Broad Spectrum UVA+UVB Protection, No White Cast, Recommended by Dermatologists, 89mL

(12)
$19.99
FREE delivery Sun, Mar 29 on your first order
1K+ bought in past month
Loading...
LG UltraWide 34WP65C-B 34 Inch 21:9 Curved FreeSync 1ms 160 Hz WQHD(3440 x 1440) Gaming Monitor, Black

LG UltraWide 34WP65C-B 34 Inch 21:9 Curved FreeSync 1ms 160 Hz WQHD(3440 x 1440) Gaming Monitor, Black

(2,271)
419.98
PrimeFREE delivery Saturday, June 14
50+ bought in past month
Loading...
Lg gram 16-inch +View Portable Monitor with USB Type-C, DCI-P3 99% (Typ.), Auto Rotate, Two-Way Supported Folio Cover

Lg gram 16-inch +View Portable Monitor with USB Type-C, DCI-P3 99% (Typ.), Auto Rotate, Two-Way Supported Folio Cover

(36)
$328.99$263.19
FREE delivery Tue, Aug 12
Loading...
StanbyME LG 27-Inch Class Smart Portable Touch Screen Monitor 27ART10AKPL. Built-in 3 Hour Battery, Full Swivel Rotation, Rollable. LG Stanbyme, Standbyme, Stand by me.

StanbyME LG 27-Inch Class Smart Portable Touch Screen Monitor 27ART10AKPL. Built-in 3 Hour Battery, Full Swivel Rotation, Rollable. LG Stanbyme, Standbyme, Stand by me.

(75)
$1,097.98
FREE delivery Sun, Aug 10
50+ bought in past month
Loading...
LG 24U411A-B 23.8" FHD (1920x1080) IPS Display Computer Monitor, 120Hz Refresh Rate, sRGB 99% (Typ.), USB-C, Reader Mode & Flicker Safe, Dynamic Action Sync, Black Stabilizer, Slim Stand Base, Black
Best Seller

LG 24U411A-B 23.8" FHD (1920x1080) IPS Display Computer Monitor, 120Hz Refresh Rate, sRGB 99% (Typ.), USB-C, Reader Mode & Flicker Safe, Dynamic Action Sync, Black Stabilizer, Slim Stand Base, Black

(2,610)
$96.95
FREE delivery Tue, Oct 14
2K+ bought in past month
Loading...
Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black
Best Seller

Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black

(17,871)
$27.98$22.38
FREE delivery Tue, Oct 14 on your first order
500+ bought in past month
Loading...
Redragon M612 Predator RGB Gaming Mouse, 8000 DPI Wired Optical Mouse with 11 Programmable Buttons & 5 Backlit Modes, Software Supports DIY Keybinds Rapid Fire Button

Redragon M612 Predator RGB Gaming Mouse, 8000 DPI Wired Optical Mouse with 11 Programmable Buttons & 5 Backlit Modes, Software Supports DIY Keybinds Rapid Fire Button

(8,052)
$22.49
FREE delivery Thu, Aug 21 on your first order
500+ bought in past month
Loading...
Samsung 990 EVO Plus - 4TB PCIe Gen4. X4, Gen5. X2 NVMe 2.0 - M.2 Internal SSD, Speed Up to 7,250 MBs, Upgrade Storage for PC-Laptops, HMB Technology and Intelligent Turbowrite (MZ-V9S4T0B/AM)

Samsung 990 EVO Plus - 4TB PCIe Gen4. X4, Gen5. X2 NVMe 2.0 - M.2 Internal SSD, Speed Up to 7,250 MBs, Upgrade Storage for PC-Laptops, HMB Technology and Intelligent Turbowrite (MZ-V9S4T0B/AM)

(1,811)
$359.99$341.99
FREE delivery Tue, Jun 17
100+ bought in past month
Loading...
SAMSUNG 990 PRO SSD 4TB PCIe Gen4 NVMe M.2 Internal Solid State Hard Drive, Up to 7,450MB/s, Heat Control, Direct Storage and Memory Expansion, MZ-V9P4T0B/AM [Canada Version]

SAMSUNG 990 PRO SSD 4TB PCIe Gen4 NVMe M.2 Internal Solid State Hard Drive, Up to 7,450MB/s, Heat Control, Direct Storage and Memory Expansion, MZ-V9P4T0B/AM [Canada Version]

(12,872)
$499.97$407.80
FREE delivery Tue, Jun 17
300+ bought in past month
Loading...
Samsung 9100 PRO Series - 4TB PCIe 5.0 x4, NVMe 2.0, M.2 Internal SSD, Up to 14,800MB/s, Fast Speed, Thermal Contorl, MZ-VAP4T0B/AM [Canada Version]

Samsung 9100 PRO Series - 4TB PCIe 5.0 x4, NVMe 2.0, M.2 Internal SSD, Up to 14,800MB/s, Fast Speed, Thermal Contorl, MZ-VAP4T0B/AM [Canada Version]

(167)
$679.97$632.37
FREE delivery Tue, Jun 17
Loading...
SAMSUNG 870 EVO SATA SSD 500GB 2.5” Internal Solid State Drive, Upgrade PC or Laptop Memory and Storage for IT Pros, Creators, Everyday Users, MZ-77E500B/AM [Canada Version]

SAMSUNG 870 EVO SATA SSD 500GB 2.5” Internal Solid State Drive, Upgrade PC or Laptop Memory and Storage for IT Pros, Creators, Everyday Users, MZ-77E500B/AM [Canada Version]

(41,678)
$74.97
FREE delivery Wed, Jun 18
400+ bought in past month
Loading...
Asus Dual NVIDIA GeForce RTX 3050 6GB OC Edition Gaming Graphics Card - PCIe 4.0, 6GB GDDR6 Memory, HDMI 2.1, DisplayPort 1.4a, 2-Slot Design, Axial-tech Fan Design, 0dB Technology, Steel Bracket

Asus Dual NVIDIA GeForce RTX 3050 6GB OC Edition Gaming Graphics Card - PCIe 4.0, 6GB GDDR6 Memory, HDMI 2.1, DisplayPort 1.4a, 2-Slot Design, Axial-tech Fan Design, 0dB Technology, Steel Bracket

(903)
$248.98
FREE delivery Sat, Jan 3
300+ bought in past month
Loading...
EZDIY-FAB RTX 3000 Series 12 Pin to Dual 8 Pin PCIe Sleeved Extension Cable 300 MM- Connector for NVIDIA Ampere GEFORCE RTX 3060ti 3070 3080 FE Funder Edition- White

EZDIY-FAB RTX 3000 Series 12 Pin to Dual 8 Pin PCIe Sleeved Extension Cable 300 MM- Connector for NVIDIA Ampere GEFORCE RTX 3060ti 3070 3080 FE Funder Edition- White

(122)
$15.99
FREE delivery Mon, Feb 16 on your first order
Loading...
MSI NVIDIA GeForce RTX 3050 Ventus 2X XS 8G OC Graphics Card - 8 GB GDDR6, 1807 MHz, PCI Express Gen 4, 128 Bits, DP v 1.4a, DL DVI-D, HDMI 2.1 (Supports 4K at 120Hz)

MSI NVIDIA GeForce RTX 3050 Ventus 2X XS 8G OC Graphics Card - 8 GB GDDR6, 1807 MHz, PCI Express Gen 4, 128 Bits, DP v 1.4a, DL DVI-D, HDMI 2.1 (Supports 4K at 120Hz)

(760)
$1,020.45
Loading...
Dell G16 Gaming Laptop 7630-16-inch QHD+ 240Hz 3ms Display, Intel Core i9-13900HX, 32GB DDR5 RAM, 1TB SSD, NVIDIA GeForce RTX 4060 8GB GDDR6, Windows 11 Home, Onsite Service - Metallic Nightshade

Dell G16 Gaming Laptop 7630-16-inch QHD+ 240Hz 3ms Display, Intel Core i9-13900HX, 32GB DDR5 RAM, 1TB SSD, NVIDIA GeForce RTX 4060 8GB GDDR6, Windows 11 Home, Onsite Service - Metallic Nightshade

(0)
$2,099.00
$11.58 delivery Aug 26 - 28