Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save kirillshevch/a7d778a6aaa788149ae86a9b313cb0ad to your computer and use it in GitHub Desktop.
Save kirillshevch/a7d778a6aaa788149ae86a9b313cb0ad to your computer and use it in GitHub Desktop.

How to disable page caching with create-react-app

If you currently not using a service worker resulting in old production caches being used and users not getting new versions of the app.

src/index.js

Use:

import { unregister as unregisterServiceWorker } from './registerServiceWorker'

unregisterServiceWorker();

Instead of:

import registerServiceWorker from './registerServiceWorker'

registerServiceWorker();
@bgabrielma
Copy link

tks.

@nadeem-khan
Copy link

In case it still gives issues, you can add these two meta tags in public/index.html:

	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Expires" content="0" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment