Skip to main content
Create the Connect instance in an effect, keep it in a ref, and call open() from the button. This prevents the widget from being recreated on every render.

Account-linking component

Replace the Vite environment-variable syntax if your build tool uses a different public-variable convention. Only the Mono public key belongs in the client bundle.

Reauthorization

Use the stored Mono account ID and call reauthorise() instead of setup().

React-specific checks

  • Initialize inside useEffect, where the DOM is available.
  • Store the instance in useRef; do not store it in render state.
  • Include values used to configure the instance in the effect dependency list.
  • Close the instance when the component unmounts.
  • Keep secret-key exchange logic in a backend route.
For the server request, follow the Quickstart. For payment-specific response handling, see Direct debit.