# NotificationProvider

Zarządza danymi wyświetlanego modala.

{% code title="NotificationProvider.js" lineNumbers="true" %}
```javascript
import React, { useState } from 'react';
import useModal from 'components/organisms/Modal/useModal';

export const NotificationContext = React.createContext({
  isOpen: [],
  notificationData: {},
  openNotification: () => {},
  handleCloseModal: () => {},
});

const NotificationProvider = ({ children }) => {
  const { isOpen, handleOpenModal, handleCloseModal } = useModal();
  const [notificationData, setNotificationData] = useState({});

  const openNotification = (text, twoButtons = false, func) => {
    setNotificationData({
      text,
      twoButtons,
      func,
    });
    handleOpenModal();
  };

  return (
    <NotificationContext.Provider
      value={{
        isOpen,
        notificationData,
        openNotification,
        handleCloseModal,
      }}
    >
      {children}
    </NotificationContext.Provider>
  );
};

export default NotificationProvider;
```
{% endcode %}
