Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I develop pwa using react native

I have searched a lot for finding the clear answer for this question but unfortunately as I am new to both of these technologies I could not find a clear answer.

I am going to develop a cross platform mobile app using PWA technology and I know that I can use react but I wonder if can also use react native too as it has been designed for mobile app while react is designed for web app.

I found this question that describes the differences between react and react native :"React native is an extra library on the top of React, to make native app for iOS and Android devices"

What is the difference between React Native and React?

Is there any conflict using react native and PWA?

Any advice would be appreciated.

like image 972
albert sh Avatar asked Jan 26 '19 05:01

albert sh


3 Answers

There is no relation between React Native apps and PWAs.

React Native are native apps written in javascript whereas PWAs are just web apps.

A web app will act as a PWA only if it contains a manifest file and is served on https. You can also use all web features like push notifications, caching etc. See the whole list here - https://whatwebcando.today

like image 63
jsartisan Avatar answered Oct 27 '22 10:10

jsartisan


You can make React Native application to work similar to PWA if you are focusing datas. There is some options to make easy mobile-server sync application even in offline.

  • Google Cloud Firestore
  • MongoDB Stitch
  • Pusher

Or you can custom by yourself using AsyncStorage based on Key-Value dictionary.

But the some functions between Web and Mobile App are different especially in storage ways, background process and service worker. Thus, the react libraries related in PWA may not work in React Native because there is no service worker and local storage is different.

like image 43
Jeff Gu Kang Avatar answered Oct 27 '22 09:10

Jeff Gu Kang


You could use react-native-web components to build your React Native app and reuse those same components on the web. There are some limitations but basically react-native-web gives you a set of cross-platform components. You could then use those components on the web side to build a Progressive Web App (PWA). I'd suggest spending some time getting a prototype working to see if it is a viable solution for your use case and so that the limitations become more readily apparent.

like image 39
Cymen Avatar answered Oct 27 '22 11:10

Cymen