看官网的几个 demo 吧,这个 api 背后的机制也是利用

Concurrent

原文

https://react.dev/reference/react/useDeferredValue

useDeferredValue(value)

Call useDeferredValue at the top level of your component to get a deferred version of that value.

Parameters

Returns

During the initial render, the returned deferred value will be the same as the value you provided. During updates, React will first attempt a re-render with the old value (so it will return the old value), and then try another re-render in background with the new value (so it will return the updated value).

Caveats