Discussions
How to close the useRutterLink modal on unmount of react app
6 months ago by Gonçalo
Hey there,
I would like to close the useRutterLink modal on unmount of a react app, useRutterLink provides an exit function:
* This hook loads Rutter script and manages the Rutter Link creation for you.
* You get easy open & exit methods to call and loading & error states.
*
* This will destroy the Rutter UI on un-mounting so it's up to you to be
* graceful to the user.
*
* A new Rutter instance is created every time the token and products options change.
* It's up to you to prevent unnecessary re-creations on re-render.
*/
declare const useRutterLink: (options: RutterLinkOptionsWithPublicKey) => {
error: ErrorEvent | null;
ready: boolean;
exit: Function;
open: Function;
};```
I'm trying to call exit on unmount with no success.
Any ideia on how to go about this?
Many thanks.