the onUnload function triggers as soon as the new window opens up so the problem is that I have this state
const [popup, setPopUp] = useState(false);
and this button
<Button onClick={() => setPopUp(true)}>Login</Button>
{ popup && !session ? (
<NewWindow url='/SignInPage' onUnload={() => setPopUp(false)} />
) : null }
so as I click on the button the state of popup become true and the new window pops up but since the onUnload function triggers before new window unload so the state of popup become false immediately and the popup closes but when I removed onUnload={() => setPopUp(false)} and clicked on the button the new window opens up and the it doesn't closes the onUnload function should triggered after the new window unload
the onUnload function triggers as soon as the new window opens up so the problem is that I have this state
and this button
so as I click on the button the state of popup become true and the new window pops up but since the
onUnloadfunction triggers before new window unload so the state of popup become false immediately and the popup closes but when I removedonUnload={() => setPopUp(false)}and clicked on the button the new window opens up and the it doesn't closes theonUnloadfunction should triggered after the new window unload