Interruptortechnology
Man getting a package ready for delivery
Photo by Bench Accounting on Unsplash

Our React Web Monetization library is on NPM

By Ciaran Edwards

We've released the code from "Web Monetization: Part 2 - Checking it's active" as a package on npm. The package currently gives you two things:

  • the WebMonetizationProvider for setting up the event listeners needed for tracking web monetization events
const MyApp = ({ children }) => {
  return <WebMonetizationProvider>{children}</WebMonetizationProvider>
}
  • the useWebMonetization hook for reading the web monetization state in your components.
const {
  isActive,
  state, // either "pending", "started" or "stopped"
} = useWebMonetization()

If you want to check it out, you can find the package on npm and the source code on GitHub.