我有一个用于实现 PWA 的 React 应用程序,我想首先将缓存策略更改为网络,但我不知道该怎么做,我读过很多关于它的文章,但没有一篇告诉你如何实际操作,这是我的代码,感谢您的帮助:
index.js:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import * as serviceWorkerRegistration from './serviceWorkerRegistration';
import reportWebVitals from './reportWebVitals';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://cra.link/PWA
serviceWorkerRegistration.register();
// If you want to start measuring performance in your …Run Code Online (Sandbox Code Playgroud)