Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ttoss/notifications

Package Overview
Dependencies
Maintainers
3
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ttoss/notifications

ttoss notifications module.

npmnpm
Version
1.16.0
Version published
Weekly downloads
55
400%
Maintainers
3
Weekly downloads
 
Created
Source

@ttoss/notifications

📚 About

This module handles notifications in your applications and other ttoss modules.

🚀 Getting Started

Install

$ yarn add @ttoss/notifications
# or
$ npm install @ttoss/notifications

📄 Usage

Provider

Add a provider on top of your application.

import { NotificationsProvider } from '@ttoss/notifications';

ReactDOM.render(
  <React.StrictMode>
    <NotificationsProvider>
      <App />
    </NotificationsProvider>
  </React.StrictMode>,
  document.getElementById('root')

Loading

This modules provides a global loading bar that you can use on every part of your App.

import { useNotifications } from '@ttoss/notifications';

const Component = () => {
  const { loading, setLoading } = useNotifications();

  return (
    <div>
      <button onClick={() => setLoading(true)} disabled={isLoading}>
        Click Me!
      </button>
    </div>
  );
};

Toast

This modules provides a global toast that you can use on every part of your App this was.

import { useNotifications, TOAST_TYPES } from '@ttoss/notifications';

const Component = () => {
  const { toast } = useNotifications();

  return (
    <div>
      <button
        onClick={() =>
          toast('Toast content', {
            type: TOAST_TYPES.SUCCESS,
          })
        }
      >
        Toast Success
      </button>
    </div>
  );
};

:::info

Examples

:::

Keywords

React

FAQs

Package last updated on 24 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts