How to use In App Browser in a React Ionic project

Is there a guide on how “In App Browser” is used in a React Ionic project?

The current doc (https://ionicframework.com/docs/native/in-app-browser/) on In App Browser seems to be targeted at Angular.

In particular, I’m trying the following code:

import { InAppBrowser } from '@ionic-native/in-app-browser';
// ...
const browser = InAppBrowser.create("some url");
browser.on('loadstart').subscribe(event => {
  // ...
})

This code is able to open.a new browser, but I’m seeing an error “Cannot read property ‘subscribe’ of undefined”, which I don’t understand why. Can someone give an example of how I should use “In App Browser” in Ionic + React?

Are you aware that Capacitor has a built-in Browser API?

I’m not, thank you for bring it up!

One follow up question: does “addListener” work for browser, or only on mobile devices? I’m implementing an OAuth flow, and I need to detect the change in the url. But I suppose since in browser “Browser.open()” actually navigates to a new site, I’m not able to add listeners?