Coding task · JavaScript and React course · Module 10: React Ecosystem and Future
Practice: Concurrent Rendering
useDeferredValue(value) returns the previous value in the urgent render and gives the new one in a second, background render - so typing does not wait for the list to filter. useTransition() returns [isPending, startTransition]: state updates inside startTransition are non-urgent, and isPending is true until the new view has rendered. You pass startTransition a function, not the result of calling setTab.
Task
Make the navigation map respond smoothly despite a catalogue of 3000 stars. ___BLANK1___: deferredQuery is the deferred version of query from useDeferredValue - the text field shows the typed text at once, while the list filters in the background (until then it is dimmed, because isStale is true). ___BLANK2___: take isPending and startTransition from the useTransition hook. ___BLANK3___: selectTab changes the tab with startTransition(() => setTab(next)), so a message with role="status" shows up while switching.