Skip to content
Discussion options

You must be logged in to vote

I click toggle button to unmount component -> network request fires (why?)

very likely because you are focused on the code window in codesandox or the browser devtools that you have opened to look at the network tab. By clicking on the button, you raise a windowFocus event, which triggers a fetch before the button click event fires.

Click anywhere in the white area before clicking the button to confirm it, but given that you've already mentioned refetchOnWindowFocus, this is likely the reason.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@szmarci
Comment options

Answer selected by szmarci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants