Converting to a Progressive Web App
We can make our app more user-friendly, especially on mobile devices, by converting it into a progressive web app (PWA). PWAs can be installed on a mobile, like all other apps, either via the app stores or directly from a prompt in the browser. PWAs can also work offline and use other advanced features such as push notifications. However, PWAs are more complicated to develop, and service workers (a key feature) can be very difficult to get right.
Service workers
Service workers are custom JavaScript scripts that act as a proxy between the web page and the server. This allows the service worker to add offline-frst functionality, such as caching pages for performance or accepting push notifications.
A PWA must have a service worker and a manifest file to work; these are available via the create-react-app
tool we used in Chapter 1, Setting Up Our System for Development. To do so, let’s create a new react
app using the PWA template in...