请问 React 中的 registerServiceWorker是干什么的？
create-react-app生成的项目中，多了一个registerServiceWorker.js，并且在 index.js 中引用，请问这个registerServiceWorker是什么东西，融合进 react 的目的是什么？
看下注释你就知道了，主要是用于在生产环境中为用户在本地创建一个`service worker` 来缓存资源到本地，提升应用的访问速度，具体看下面这段注释。
```
// 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.
```