Click in order · JavaScript and React course · Module 10: React Ecosystem and Future

useDeferredValue Pattern

Arrange a component that defers filtering the star list with useDeferredValue and dims the stale result:

Items to click

  • const deferredQuery = useDeferredValue(query);
  • const isStale = query !== deferredQuery;
  • return <Results query={deferredQuery} dimmed={isStale} />;
  • function StarList({ query }) {
  • }

You can check the correct answer by solving this task in the CodeWorlds game.