{"id":2063,"date":"2019-07-20T21:07:07","date_gmt":"2019-07-20T21:07:07","guid":{"rendered":"https:\/\/www.codeastar.com\/?p=2063"},"modified":"2019-07-20T21:07:22","modified_gmt":"2019-07-20T21:07:22","slug":"pwa-create-easy-progressive-web-app-with-react","status":"publish","type":"post","link":"https:\/\/www.codeastar.com\/pwa-create-easy-progressive-web-app-with-react\/","title":{"rendered":"PWA – Create Easy Progressive Web App with React"},"content":{"rendered":"\n
Nowadays, using smart mobile is a part of our daily life. People use mobile apps to do things they want to do, messaging, shopping, reading, learning, and the list goes on. In order to enter the mobile users market, companies need to spend time and effort to create an app then publish it on Google Play or Mac App Store. While websites can be built easier and reached by more audiences. What if… What if we combine the convenience of apps and the reach of webs? So we have — Progressive Web App (PWA). <\/p>\n\n\n\n\n\n\n\n
As we mentioned earlier, PWA is a type of mobile app which works like ordinary apps and reaches like ordinary webs. A PWA can be installed on our mobile with an app icon, just likes other apps in our phone. It is fast and accessible in offline mode. And since it can be installed directly by entering a web url, instead of using Play \/ App Store to search and download. It is easier for people to add the app to their phone.<\/p>\n\n\n\n
Ain’t it attractive? Yes! But what do we need to build a PWA? HTML, JavaScript and CSS. Wow, it sounds easy! Yes, then what are we waiting for? <\/p>\n\n\n\n
We used React to build a weather forecast frontend<\/a> in past. And we know how React can make the job done in an easy and component based way. So we decide to use React agto build our PWA. But before we move to step 1, there is a step 0. The reference links for PWA:<\/p>\n\n\n\n You can take a look on above links to find more details about PWA. Or you can go straightly with our steps to build a PWA. <\/p>\n\n\n\n Let’s use create-react-app <\/em>command to create our React template, pwa_funhouse<\/em>!<\/p>\n\n\n\n Then we start our pwa_funhouse <\/em>web app.<\/p>\n\n\n\n You may notice that I use yarn<\/a> instead of npm<\/a> to start the React app. As I find the Facebook created package manager, yarn, out performs npm in speed and stability (you can still use npm by the way).<\/p>\n\n\n\n After running the start command, it will pop out the pwa_funhouse <\/em>app on your default browser. <\/p>\n\n\n\nStep 1: Create a React web app<\/h3>\n\n\n\n
$npx create-react-app pwa_funhouse<\/code><\/pre>\n\n\n\n
$cd pwa_funhouse\n$yarn start<\/code><\/pre>\n\n\n\n