Nextjs actions in 0 milliseconds @DevLeonardo
Nextjs actions in 0 milliseconds  @DevLeonardo
Uploaded July 2024 | Updated September 2026, 3 weeks ago
What if you could make your backend respond in 0ms? ⚡️

In a real scenario, some api calls will most often be successful (hopefully) so here's the trick, bring some optimism in your application and instantly update the UI as if the operation went through.

You can't have a slow backend, if you don't even wait for the response 🧠

I tested the useOptimistic hook introduced in React 18 in my new Nextjs 14 side project and I thought it was worth sharing!
_______________________________
Support my work: github.com/sponsors/Balastrong ❤️

Hit like and subscribe for more content! :D

Beginner-Friendly Open Source Projects: github.com/DevLeonardoCommunity
Join the Discord community! Here's the invite: discord.gg/bqwyEa6We6

You can also follow me on the other platforms:
Twitter: twitter.com/Balastrong
dev.to: dev.to/balastrong
GitHub: github.com/Balastrong
Home: https://leonardomontini.dev/
TikTok: tiktok.com/@balastrong
Instagram: instagram.com/devbalastrong

_______________________________
TIMESTAMPS
00:00 Problem Showcase
01:00 Simple Optimistic Update
02:00 Optimistic Array Element Removal
04:40 Updates Outside Server Actions
05:24 Optimistic Double Render
06:00 Optimistic Reducer
08:12 Bonus Tip
08:38 Code on GitHub - Myntenance Project

#nextjs #coding #reactjs
Nextjs actions in 0 milliseconds[GitHub UPDATE] Comment entire Files on Pull RequestsWarp or Fig? Enhancing your terminal experienceI vibe coded an online visitors counter for my blogTanStack Router: Code Based RoutingGet AI Autocomplete on Terminal - figTanStack React Form: Validation with zodDo you Know Javascript? [Round 3]How TanStack releases multiple times a dayGIT Flight Rules to save your repositoryWill GitHub Copilot become the Captain? [Live Session Recording]A new tool to Create React Apps with TanStack
Dev Leonardo |

Nextjs actions in 0 milliseconds

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER