Grokking React Advanced
Vote

0% completed

​

Concurrency with useDeferredValue

What can you do when the value that drives a slow render is not state you own? In the previous lesson, ProductSearch called setListQuery itself, so it could wrap that call in startTransition. A component that receives the search text as a prop, or from a custom hook, has no set function to wrap.

React has a second tool for this case. You give it a value, and it returns a copy of that value that is allowed to lag behind during a render. The copy is called a deferred value, and the hook is useDeferredValue.

The hook

`useDeferredValue

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content