source: imaps-frontend/src/components/Modals/Hooks/useModalEvent.jsx

main
Last change on this file was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 334 bytes
Line 
1import {useEffect} from "react";
2
3export function useModalEvent(openModalHandler,eventName){
4 useEffect(() => {
5
6 if(eventName == null) return;
7
8 window.addEventListener(eventName, openModalHandler);
9
10 return () => {
11 window.removeEventListener(eventName, openModalHandler);
12 };
13 }, []);
14}
Note: See TracBrowser for help on using the repository browser.