Next.js Discord

Discord Forum

How to add optimistic updates for Next.js Commerce' add to cart + quantities to speed it up.

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
We've implemented the cart functionality for your Next.js 14 RSC App Router ecommerce site like it is shown in https://github.com/vercel/commerce

Now we need to figure out a way to speed it up, so you don't wait for the server response every time your in/decrease the quantity amount or adds an item to the basket.

How to speed it up? Do you use React's "useOptimistic" hook or is there a better way? Any example of this would be greatly appreciated.

2 Replies