Last active
January 13, 2022 10:37
-
-
Save hamidKMB/7f59ce9dd4d0d0b51b95a2424a050f65 to your computer and use it in GitHub Desktop.
Refresh Page One Time on React JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const reloadCount = sessionStorage.getItem('reloadCount'); | |
if (reloadCount < 1) { | |
sessionStorage.setItem('reloadCount', String(reloadCount + 1)); | |
window.location.reload(); | |
} else { | |
sessionStorage.removeItem('reloadCount'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment