正在加载视频...

视频加载失败

✍️ New blog post: "Instant Search Params with React Server Components" The result of my three-week obsession with React's new useOptimistic hook — ultimately leading me to a much richer understanding of React transitions. Hope you enjoy!

103,117 次观看 • 2 年前 •via X (Twitter)

10 条评论

Ryan Florence 的头像
Ryan Florence2 年前

Didn’t read it yet… is useOptimistic for the pending search param you just selected to instantly go purple instead of after the data comes?

Sam Selikoff 的头像
Sam Selikoff2 年前

Correct 👍

Clovis Rosa 的头像
Clovis Rosa2 年前

That is the missing pice from the last podcast. Thank you very much! Next stop, YT video pleaseeee! 🙏🏾

Sam Selikoff 的头像
Sam Selikoff2 年前

Bingo!

Devon Govett 的头像
Devon Govett2 年前

Great post!

Sam Selikoff 的头像
Sam Selikoff2 年前

Thanks Devon!

François Best - 🦋 的头像
François Best - 🦋2 年前

Interesting! I built `nuqs` with the same idea in mind: keep the UI responsive, while the request is in flight and eventually settles, but that was before useOptimistic existed.

Sam Selikoff 的头像
Sam Selikoff2 年前

Very cool! I think higher-level hooks like this still have their place – you could useOptimistic under the hood so it gets the behavior around transitions for free.

Coding in Flow 的头像
Coding in Flow1 年前

Why does setOptimistic have to be wrapped into startTransition? I tried moving it outside and the behavior looks the same.

Madat Bayramov 的头像
Madat Bayramov2 年前

Just read it, very detailed, and you've included a few good use cases. Worth to read

相关视频