useTransition

Returns a stateful value for the pending state of the transition, and a function to start it.

startTransition lets you mark updates in the provided callback as transitions.

Can cause content flashes if the completion is too fast - like on this page!

On this page, when you click the button, text appears saying 'Loading...'

However, because the page loads so quickly, this just appears as a quick flash below the button

As a result, useTransition is best used:

const [isPending, startTransition] = useTransition();

Example