Skip to content

Instantly share code, notes, and snippets.

@hamidKMB
Last active January 13, 2022 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamidKMB/7f59ce9dd4d0d0b51b95a2424a050f65 to your computer and use it in GitHub Desktop.
Save hamidKMB/7f59ce9dd4d0d0b51b95a2424a050f65 to your computer and use it in GitHub Desktop.
Refresh Page One Time on React JS
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