AceDevHub
Advanced React Interview QuestionsAdvancedCode Output

React · Question 73

What is the console output, and does startTransition delay its callback?

Direct answer

The output is Before, Inside, After because startTransition calls its action immediately; it marks qualifying state updates inside that call as Transitions rather than delaying ordinary JavaScript execution.

transition-order.js
console.log("Before");

startTransition(() => {
  console.log("Inside");
});

console.log("After");
Output
Before
Inside
After

The function passed to startTransition() runs immediately. React's special behavior applies to state updates scheduled during that call, not to the execution timing of normal statements like console.log().