Sorry for this idioit question. I’m a beginner developer of React. I know this library https://github.com/necolas/react-native-web can compile React Native runs as PWA, so does it mean that I just need to write the codes one time for both iOS and Android app and PWA?
Do I understand correctly?
The answer is a little bit more complicated but +/- yes. Mostly you write one code and its working everywhere, but there are platform needs that are different and you need to cover it sometimes differently.
Related
I made a website (not yet online), it uses HTML, CSS, Javascript, only. No React or Angular, and I have the following problem :
I'd like to make a cross-platform application based on it (for iOS, Android, Windows, Linux and MacOS).
What's the best way to do that ?
My searches :
I did few searches, not really satisfactory, because it seems I'll need to re-make my client-website entirely !
I found 2 ways : React Native and NativeScript, like described here.
Have you some other option ?
If you don't, is it really impossible to keep the code in React ? Like I can see there
I'm a bit confused, and I don't know what I should do to perform what I want.
Thank you for all answers you could give me !
For Desktop Development you can try Electron. It's a js library which helps you build cross platform applications by using Node, Chromium and js.
You can also go one step ahead and add react to it.
Applications like VSCode, Skype, Microsoft Teams, Spotify and I think even Slack are made using it.
For Mobile Development, you can go with React Native. In this way you'd make a cross platform mobile dev app too.
The pros are that using these tech stack you can build modern cross platform apps. For a web dev, this is the way to go.
The cons of Electron:
It's little heavy on memory, but nothing that would be a bottleneck.
The cons of React Native:
Is not suited for apps that require heavy computation and it's bundle size is significantly larger than the native apps
I want to add to this :There is an other option nw.js for desktop app it's like electron using chromium ,node and js.
and for the front-end you can use angular, react, vue it is really as you want .This is a link https://nwjs.io/ (It is cross-platform too ).
For mobile development I think I will recommend you : NativeScript (https://play.nativescript.org/?_ga=2.144049845.1620166462.1585302566-1314322155.1583139217) . It is a good option also cause you can easily add your website(html,css,javascript files ) in your NativeScript webview as your interface and I think this option won't take you time as making an other one with react-native (even if I know that react-native have his webview too).
So go and have a look to this ::How to load a local html file into a NativeScript webview .
Then all your work will be the database in sqlite but even for this you have :https://www.npmjs.com/package/nativescript-sqlite and other things to go quickly
:https://market.nativescript.org/
I'm trying to find a better way to write and compile my React-based code.
For a class, we wrote our code primarily in Expo.io, which emulated a mobile experience as well as optionally connecting to our phones. I did not find this to be very usable due to the automatic error tagging.
I am new to react native I want to know can we able to share the same code base for web-based and for the mobile application using react native.
If yes then how to do that?
I think you're referring to using React to build a web application and then wondering if you can port it to React-Native? You can share the same idea's, method, and architecture. But no, the code doesn't translate 100%, really not even 50%. React vs React-Native use different things, for example React uses < Div >'s while React-Native uses < View >'s, img to < Image >, etc. So while figuring out many of the design questions and implementation for the web version will surely make your RN development faster. You still need to plan on the RN port being the same Development process (plus longer for bug testing on the many different devices) and allow a developer adequate time.
The answer is yes. You can share the same code using react-native-web.
But keep in mind that the idea behind React and React Native projects is that you could learn one time and use everywhere so their goal is to make possible to use a very similar architecture, data flow, etc. but not sharing the same code. Also, a lot of packages and third-party components will not work as expected. So, react-native-web is a very interesting project and you should definitely give it a chance, but most of the times it will not do the job 100%.
I'm just learning React Native for a cross platform app I am building.
I just need to know if it is (a) possible (b) supported (c) relatviely simple to mix native, platform specific code (java, swift, objc, etc.) into a react native project.
I want to do some pretty specific things with camera/hardware that will require writing some native code.
Hoping someone can point me in the right direction or at least tell me that what I want to do is supported by React Native before I dive in too far.
Yes to a, b, and c. See the official guides for iOS and Android.
All:
I am thinking of starting React Native, one reason is many people talk its performance is better than other Hybrid Framework, but I am wondering how React Native make it faster in Mobile, I thought all hybrid app is like a web app run in a webview, is the way React Native uses different from Cordova? Could anyone talk about the procedure how React Native is turned into a mobile app?
Thanks
I agree with the other comments. Your question is a bit broad, but the short of it I think is that hybrid apps rely on the WebView, so they're performance is limited by the browser's performance, which is of course single threaded. Getting 60fps animations is a constant struggle for Hybrid apps, though they're getting better all the time both in terms of the browser's capabilities and technique.
React Native bridges to native components, so you get native performance characteristics. Things like calculating the view are offloaded acync to separate threads, so the user's experience is never blocked.
Here's a useful list of other benefits...
WHY REACT NATIVE IS THE BEST SOLUTION WE HAVE SO FAR FOR NATIVE MOBILE DEVELOPMENT
sorry for the all caps... that's the actual title of the list :/