Skip to main content

useWhatsAppLoginModal

useWhatsAppLoginModal is a custom React hook designed to streamline process of opening modal for WhatsApp login. It abstracts away complexities of managing modal state and provides a simple interface for triggering display of login modal.

Usage

import React from 'react';
import useWhatsAppLoginModal from 'path/to/useWhatsAppLoginModal';

function WhatsAppLoginButton(): JSX.Element {
const { open } = useWhatsAppLoginModal();

const handleWhatsAppLogin = () => {
// Open the WhatsApp login modal
open();
};

return (
<button onClick={handleWhatsAppLogin}>Login with WhatsApp</button>
);
}

export default WhatsAppLoginButton;

Parameters

  • props: An optional object containing properties to customize the modal, such as modalProps of type ModalProps.

Returns

An object containing the following property:

  • open: A function that, when called, opens the WhatsApp login modal.