I am trying to implement feature on my react app,
I want to close my child tab (Build with Reactjs) whenever my parent Tab (that is actually opening my React App).
Child tab is closing when I am refreshing it But not closing on real time.
Here is some code that I am trying.
useEffect(() => {
Events.emit(types.PARENT_CLOSE, '');
loadApplication();
}, [window.parent.location]);
useEffect(() => {
if(window.location !== window.parent.location || true){
Events.on(types.PARENT_CLOSE, () => {
window.opener = null;
window.open('', '_self');
window.close();
});
}
return ()=>{
EventSource.off(types.CLICK_AWAY)
}
}, []);```