create-react-appのregisterServiceWorkerについて
いくらググっても情報がなくて、灯台下暗しで、registerServiceWorker.jsのファイルを開いてみるとコメントが書いてあった。
registerServiceWorker.js
// In production, we register a service worker to serve assets from local cache.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on the "N+1" visit to a page, since previously
// cached resources are updated in the background.
// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
// This link also includes instructions on opting out of this behavior.
ってことで、キャッシュしてるってことです。詳しくは、
https://goo.gl/KwvDNy
ここを見なさい、とあるので、見ると。。。
本番時は必要みたいですが、開発時はキャッシュしてほしくないのでコメントしちゃっても良さそうです。
import { unregister } from './registerServiceWorker';
まだ勉強中なのでよくわかってませんが、確実に消すには
こんな感じで書くとキャッシュを消してくれる?ってことかな?
ということで、「registerServiceWorker」とは?と検索しても日本語の説明がなかったので残しておきます。