useTransition

Defines one or more Transition animations for the given component


Defines one or more Transition animations for the given component and allows for the Transition to be re-evaluated based on changes in the deps

deps should contain any props, states or derived values that are either used within the createTransition lambda, or are needed to trigger a re-evaluation of the transition. For example, when a component needs to be animated every time a boolean state changes, that state should be added to deps, even if the state itself isn't necessarily referenced inside createTransition.

Parameters

deps

A list of dependencies that will trigger a re-evaluation of the transition.

createTransition

A lambda that creates the Transition object.


Deprecated (with error)

useTransition must provide 'deps' parameter that determines when the transition should be recalculated.

Defines single or multiple Transition animations for the given component.

It is an error to call useTransition without deps parameter.

Note: the cases where the transition should be applied unconditionally, or only on first render can be achieved by passing Any() or Unit as deps respectively. The unconditional case can also be achieved by using the simple useTransition function that takes a direct Transition object.