ModalContext.tsx 464 B

1234567891011121314151617
  1. 'use client';
  2. import Modal from '@/components/Modal2';
  3. import useModal from '@/hooks/use-modal';
  4. import { createContext } from 'react';
  5. export const ModalContext = createContext({ showModal: false, handleModal: () => {} });
  6. export const ModalProvider = ({ children, modalContent }) => {
  7. const value = useModal();
  8. return (
  9. <ModalContext.Provider value={value}>
  10. <Modal content={modalContent} />
  11. {children}
  12. </ModalContext.Provider>
  13. );
  14. };