Purpose: Provides a button for navigating back, with intelligent handling of different scenarios including redirect URLs and browser history.
The Back Button component uses the following logic to determine its behaviour when clicked:
- If there is a "redirect" parameter in the current URL's search params (for example: https://limio-shop.limio.com/cart?redirect=/landing-page), then navigate to the URL while preserving other URL parameters (except "redirect").
- If no "redirect" URL is present but there's a previous page in the browser history, then navigate back to the previous page.
- If there's no "redirect" URL and no previous page in history, then navigate to the origin of the current page (window.location.origin).
Props
Prop ID | Prop Label | Type | Default Value | Info |
---|---|---|---|---|
buttonLabel | Button Label | string | Back | Displays the text on the button |
Comments
0 comments
Article is closed for comments.