[]previous and next page

inTransition

Tells whether a transition callback or a transition-lane run is active, so the writes made now belong to the lane.

Tells whether a transition callback or a transition-lane run is active, so the writes made now belong to the lane. Use it in a primitive that treats transition reads differently, such as a data reader that holds the boundary only in a transition.

Import#

ts
import { inTransition } from "@shadow-js/core/extend";

Signature#

ts
function inTransition(): boolean

Returns#

True inside startTransition's callback and while the lane runs.

Examples#

ts
import { startTransition } from "@shadow-js/core";
import { inTransition } from "@shadow-js/core/extend";

void startTransition(() => {
  console.log(inTransition()); // true in the browser
});
console.log(inTransition()); // false