Skip to content

Instantly share code, notes, and snippets.

@Hydrock
Created August 25, 2021 11:22
Show Gist options
  • Save Hydrock/7b34551b51a9fdf6c057a9447accc402 to your computer and use it in GitHub Desktop.
Save Hydrock/7b34551b51a9fdf6c057a9447accc402 to your computer and use it in GitHub Desktop.
const App = () => {
// ...
const [isPending, startTransition] = useTransition({ timeoutMs: 2000 });
startTransition(() => {
setSearchQuery(input);
});
// ...
return (
<span>
{isPending ? " Loading..." : null}
{/* ... */}
</span>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment