Is there a better way to open a URL in WebView?

My current code looks like below.

backend

.withNativeFunction("openInBrowser",
    [safe_this = juce::Component::SafePointer(this)](auto& var, auto complete)
    {
        auto _href = var[0].toString();
        DBG("openInBrowser: " << _href);
        const auto href = juce::URL{ _href };
        href.launchInDefaultBrowser();

        // If you want to allow only limited origin...
        //const auto allowedOriginList = juce::StringArray{
        //    "https://example.com"
        //};
        //if (allowedOriginList.indexOf(href.getOrigin()) != -1) {
        //    href.launchInDefaultBrowser();
        //}
    }
)

frontend

import { getNativeFunction } from "juce-framework-frontend-mirror"
import { ComponentPropsWithoutRef, ReactNode } from "react"

interface Props {
  href: string
  children: ReactNode
}

export function JuceLink({
  href,
  children,
  onClick,
  ...props
}: Props & Omit<ComponentPropsWithoutRef<'a'>, keyof Props>) {
  const openInBrowser = getNativeFunction('openInBrowser')

  return (
    <a
      href={href}
      onClick={async (e) => {
        onClick?.(e)
        console.log('open ', href)
        await openInBrowser(href)
      }}
      {...props}
    >{children}</a>
  )
}