You pass a function to startTransition. Calling setTab before passing a function would schedule the update outside the transition.