usePageLocation

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.

署名

コピー
1

リターン

A PageLocation object:

コピー
1
名称タイプ説明
pageIdストリングID of the current page.
pathnameストリングAny parts of the current URL path appended to the page's full URL path. Learn more.
探索ストリングOptional. The current URL's query string.
hashストリング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.

Client side routing

In this example, we use the pathname returned by usePageLocation() to define which view the component rendered.

コピー
1
役に立ちましたか?
はい
いいえ