import { Meta } from '@storybook/blocks'; # useNotificationState The `useNotificationState` hook returns the state for developing `NotificationGroup` like component. ### Return Value ```javascript { notifications: [{ id?: string; severity?: Severity; message?: string; autoClose?: boolean; autoCloseDelay?: number; replaceAll?: boolean; }] } ``` ## Importing ```javascript import { useNotificationState } from 'amazon-chime-sdk-component-library-react'; ``` ## Usage The hook depends on the `NotificationProvider` being rendered. ```jsx import React from 'react'; import { NotificationProvider, useNotificationState, NotificationGroup } from 'amazon-chime-sdk-component-library-react'; const App = () => ( ); const MyChild = () => { const { notifications } = useNotificationState(); const dispatch = useNotificationDispatch(); const notificationItems = {notifications.map(({ id, ...rest }): any => ( dispatch({ type: ActionType.REMOVE, payload: id })} /> ))}; return ( {notificationItems} ) } ``` Note: Check `ActionType` information in `useNotificationDispatch` [documentation](/docs/ui-hooks-notification-usenotificationdispatch--page). ### Dependencies - `NotificationProvider`