Skip to content

[Docs]: useViewTransition is misleading #14686

@davidsainez

Description

@davidsainez

Describe what's incorrect/missing in the documentation

Docs state the following:

This hook returns true when there is an active View Transition to the specified location.

Which I interpreted to mean it only matches on the nextPath. But the source seems to show that the hook returns true bidirectionally:

return (
    matchPath(path.pathname, nextPath) != null ||
    matchPath(path.pathname, currentPath) != null
);

My use case was to apply a different animation depending on the direction of navigation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions