Skip to content

bug: useIonRouter is undefined #26386

@SeverinPeter92

Description

@SeverinPeter92

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

I'm trying to destruct the navigate function from useIonRouter. But useIonRouter will throw a Typescript error

Uncaught TypeError: Cannot destructure property 'canGoBack' of '(0 , vue__WEBPACK_IMPORTED_MODULE_0__.inject)(...)' as it is undefined.

Expected Behavior

The function navigate can be desctructured from useIonRouter

Steps to Reproduce

Import useIonRouter from @ionic/vue
Destructure the function navigate from useIonRouter

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI: 6.20.1
Ionic Framework : @ionic/vue 6.2.6

Capacitor:

Capacitor CLI : 4.3.0
@capacitor/android : 4.3.0
@capacitor/core : 4.3.0
@capacitor/ios : 4.4.0

Utility:

cordova-res : 0.15.4
native-run : 1.7.0

System:

NodeJS : v16.16.0 (C:\Program Files\nodejs\node.exe)
npm : 8.19.2
OS : Windows 10

Additional Information

No response

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