December 2019
Intermediate to advanced
474 pages
10h 3m
English
Create React App comes with a configuration for that supports PWA, generated when we initiate the build script. We can set up our Create React App project as a PWA by accessing the src/index.js file and changing the last line, which will register the serviceWorker:
import React from 'react';import ReactDOM from 'react-dom';import './index.css';import App from './App';import * as serviceWorker from './serviceWorker';ReactDOM.render(<App />, 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: http://bit.ly/CRA-PWA- //serviceWorker.register();+ serviceWorker.register(); ...Read now
Unlock full access