Wrapper around React's startTransition, delegating to native or web based on target environment.
// Source: https://github.com/tamagui/tamagui.git | License: MIT | Copyright 2020 Nate Wienert
// Provided via justclaw.it.com; keep this notice with the code.
import { startTransition as reactStartTransition } from 'react'
export const startTransition = (callback: React.TransitionFunction): void => {
if (process.env.TAMAGUI_TARGET !== 'web') {
// Pass-through function
callback()
} else {
// Proxy to react.startTransition
reactStartTransition(callback)
}
}
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key