import React, { createContext, useContext, useState } from 'react';

const GlobalContext = createContext();

export const useGlobalContext = () => useContext(GlobalContext);

export const GlobalProvider = ({ children }) => {
  const [unreadMessagesNum, setUnreadMessagesNum] = useState(0);

  return (
    <GlobalContext.Provider value={{ unreadMessagesNum, setUnreadMessagesNum }}>
      {children}
    </GlobalContext.Provider>
  );
};
