This hook is deprecated. For more information, see Migrating from dashboard-react.
A React hook that provides access to the currently rendered dashboard page's location data. A component using this hook re-renders whenever the current page's URL changes.
A PageLocation
object:
Name | Type | Description |
---|---|---|
pageId | string | ID of the current page. |
pathname | string | Any parts of the current URL path appended to the page's full URL path. Learn more. |
search | string | Optional. The current URL's query string. |
hash | string | Optional. The current URL's fragment identifier. |
pathname
The value of pathname
is any part of the URL path that comes after the route to the current dashboard page.
For third-party app dashboard pages, this is anything appended to the URL after the Relative route value that you set when creating the dashboard page extension in the Wix Developers Center.
In order to set up a dashboard client for React, please refer to the setup guide.
In this example, we use the pathname
returned by usePageLocation()
to define which view the component rendered.