React:PWA
lastmod 2023-02-02created 2023-02-022 edits
How to start a PWA app in React.
Create Project
# JavaScript
npx create-react-app my-app --template cra-template-pwa
# TypeScript
npx create-react-app my-app --template cra-template-pwa-typescript
manifest.json
The app configuration file.
-
short_name- App name. The name shown below the icon -
name- Full name of the app -
icons- App icon settings. Each platform requires different icon sizes -
start_url- Sets the page shown first when the app is clicked -
display- Sets whether to remove the browser's top bar when the app runs -
theme_color- Sets the theme color -
background_color- Sets the background color
index.js
Change the setting in index.js so that a service-worker.js file is generated at build time.