Overview
Returns a function to open URLs through the host application. The host controls how the link is opened (new tab, in-app browser, etc.).
Import
import { useOpenLink } from 'sunpeak';
Signature
function useOpenLink(): (params: OpenLinkParams) => Promise<void>
OpenLinkParams
Returns
openLink
(params: OpenLinkParams) => Promise<void>
Function to open a URL through the host application.
Usage
import { useOpenLink } from 'sunpeak';
function MyResource() {
const openLink = useOpenLink();
return (
<button onClick={() => openLink({ url: 'https://example.com' })}>
Visit Website
</button>
);
}