Current section: Responsive 29 exercises
Problem

useDeferredValue

Loading exercise

Transcript

00:00 Currently, everything is working with a start transition. When I make a change to the value, we're doing set value inside of a transition. That way, when this suspends, we can give it some pending UI. If I type in the letter I, then well, if it took longer, then we would see that suspending UI.

00:18 Let's make this take a little bit longer, and then we'll type in N, and now we're going to see that pending UI. We're getting is pending from the transition. The problem is that as we type, every character we type is not showing up in that input.

00:36 And that's because when we set the value, that doesn't update the state immediately. Remember, we're pending, and so the suspense boundary is going, or the transition is going to prevent any UI updates from happening until suspense is finished, and that includes our input value.

00:54 So your job is to switch to use deferred value for this so that we can update the value instantly, but also handle the suspense scenario and get the pending situation so we can render a pending UI when the user is interacting with this search filter.

01:13 All right, that should be enough for you. Good luck.