@evefrontier/dapp-kit - v0.0.1
    Preparing search index...

    Function useNotification

    • Hook for displaying user notifications in EVE Frontier dApps.

      Provides a simple notification system for displaying success, error, warning, and info messages to users. Commonly used after transaction completions or to display important status updates.

      Returns NotificationContextType

      Object containing notification state and methods:

      • notify - Function to trigger a notification
      • notification - Current notification state object with:
        • isOpen - Whether notification is visible
        • message - The notification message
        • severity - The notification type (success, error, warning, info)
        • txHash - Optional transaction hash for linking
        • handleClose - Function to close the notification

      If used outside of EveFrontierProvider

      import { useNotification, Severity } from '@evefrontier/dapp-kit';

      const MyComponent = () => {
      const { notify } = useNotification();

      const showSuccess = () => {
      notify({ type: Severity.Success, message: 'Operation completed!' });
      };

      return <button onClick={showSuccess}>Complete</button>;
      };
      const { notify } = useNotification();

      const handleTransaction = async () => {
      try {
      const result = await sendTransaction();
      notify({
      type: Severity.Success,
      message: 'Transaction successful!',
      txHash: result.digest
      });
      } catch (error) {
      notify({
      type: Severity.Error,
      message: 'Transaction failed'
      });
      }
      };
      const { notification } = useNotification();

      return (
      <>
      {notification.isOpen && (
      <Alert severity={notification.severity} onClose={notification.handleClose}>
      {notification.message}
      </Alert>
      )}
      </>
      );