What's the different between React Native and ReactXP - mobile

ReactXP is pretty new, nothing much about it out there.
AFAIK
Both ReactXP and React Native can build native mobile apps (iOS, Android).
ReactXP is something build on top of ReactJS/React Native.
Looks like the purpose of React Native and ReactXP are same -- building cross platform mobile apps.
Is it ReactXP just more Microsoft friendly?

The authors of React use the phrase “learn once, write anywhere”.
With React and React Native, your web app can share most its logic with your iOS and Android apps
Problem: the view layer needs to be implemented separately for each platform.
ReactXP(Solution): a thin cross-platform layer which can share your view definitions, styles and animations across multiple target platforms.
More: In general, it exposes APIs, components, props, styles and animation parameters that are implemented in a consistent way across React JS (HTML) and React Native for iOS and Android. A few platform-specific props and style attributes have been exposed, but we have tried to keep these to a minimum.
Source/Reference: https://microsoft.github.io/reactxp/

ReactXP is built using React and React Native, and the lifecycle methods remain the same across both platforms. The main difference between React Native is that ReactXP works out of the box with not only iOS and Android, but also on the web and on WindowsOS!

Related

What is the difference between React, ReactJS, and React Native? [duplicate]

This question already has answers here:
What is the difference between React Native and React?
(45 answers)
Closed 1 year ago.
I want to study a course about React, but I don't know couple of things, like:
What is the difference between React, ReactJS, and React Native ?
Well, if there is a big difference, What is the best one of them to study ?
I am really looking forward to study it, so if you got any information on the best way to start learning this course, I would appreciate it.
Thank you so much.
React and React.Js is one and the same.
React / ReactJs
ReactJS is an open-source JavaScript library used to build the user interface for Web Applications. It is responsible only for the view layer of the application. It provides developers to compose complex UIs from a small and isolated piece of code called "components." ReactJS made of two parts first is components, that are the pieces that contain HTML code and what you want to see in the user interface, and the second one is HTML document where all your components will be rendered.
React Native
React Native is an open-source JavaScript framework used for developing a mobile application for iOS Android, and Windows. It uses only JavaScript to build a cross-platform mobile app. React Native is same as React, but it uses native components instead of using web components as building blocks. It targets mobile platforms rather than the browser.
Link for Further information
What is the best one of them to study ?
React and React native both solves different kind of problem. React is common library between react and react-native which provides supports for hooks and generate virtual dom.
react-dom will render content on web using virtual dom created by react.
However on other side react-native will create bundle for android and iOS.
Main differences between Reactjs and React Native
When it comes to a web platform, Reactjs can be defined as a base
derivative of React DOM, while React Native acts as a base
derivative by keeping workflow and syntax the same alongside
altering components.
React is a JavaScript library that can help your developers in
building a highly responsive UI Layer and React Native on the other
hand is a complete framework to develop cross-platform applications.
Virtual DOM is used to extract browser code in React; native APIs
help in rendering components in mobile in React Native.
In React Native, UI is rendered with the help of JSX but the
applications curated with Reactjs extract HTML in UI.
For styling in Reactjs, CSS is used, and React Native platform
requires a stylesheet for styling.
Using CSS, you can carry out animation in Reactjs; for animation in
React Native, you need to use an animated API.

How can i use my react component as a web component with just a javascript tag call

I am working on a react app with mapbox that gets data from a JSON file and adds the data on the app.. I have successfully built the app. But what I want now is that I want to be able to use my react-app as a web component. In a way that it will be usable in websites and web apps.
Think of it this way:
Your React application is the U-Haul truck that delivers everything from the Web Server (Back-End) to the Browser (Front-End)
Now you say you want everything wrapped in a (native) Web Component:
<move-house></move-house>
It is do-able, but you as the Developer have to develop all dependencies
It starts by fully understanding what React is and does, so you can wrap all its behaviour.
Unlike other Frameworks (Angular, Vue, Svelte) React has no "Make-it-a-Web-Component" option,
because React, with its virtual DOM, is a totally different (and rather outdated) beast that doesn't comply with modern Web Standards. (today [Dec2020] React only scores 71% on the Custom Elements Everywhere test)
See: https://custom-elements-everywhere.com/libraries/react/results/results.html
for what you as the developer have to fix, because React does not do that for you
Some say React compared to modern JavaScript technologies, Frameworks, Web Component libraries like Lit and Stencil or Svelte, is more like:
It is possible in react using direflow. https://direflow.io/

Porting a full blown react web app to react native

I have a full blown mobile web app using the following:
React
Redux
Redux-React
React Router
Firebase
I eventually want to convert this mobile web app to a mobile app and I am looking into using React Native. There is a lot of literature on how to build React Native apps from scratch or to convert a native app in Objective-C to react native but I am struggling a bit to find some prior-art of how to approach taking a mobile web app towards native.
More specifically, what are the things that wont work out of the box? I am looking at React-Router.
Some thoughts around how to start transitioning, what to touch and what to not worry would be very helpful.
UPDATE:
Imagine the following app structure. Its already a lot of code. So, I am wondering if there are approaches to do this incrementally?
Many folks are porting their React applications to React Native incrementally by using Web View as an initial 'foot in the door', and then using React Native views on a flow-by-flow basis. With the recent availability of react-native-webview-bridge ( https://github.com/alinz/react-native-webview-bridge ), two-way communication between those web views and the react native components is now very easy.
There can be performance issues when using Web Views on iOS versus the regular Safari app, so that may force certain UI flows to be converted to React Native before you can ship.
I'd highly recommend translating any Selenium tests to Appium to keep your automated test coverage up. React Native is still a bit volatile, and being able to upgrade quickly and safely will be highly dependent on having an automated test suite.
Be sure to have your API (is you have one), your reducer and your action outside of your web folder, because you'll be able to use them in your mobile app.Most of your app structure will be the same, except for the react-router. Like Jan Fanz Palngipang, you could use react-native-router-flux (which is the one i'm using)
I would recommend you to check starter kit like nativebase, rReact Starter Pro to see how their drawer is working.(see how they change container)

Can we combine react naitve and IONIC?

can we combine IONIC for User interface and react native for device communication? I like to use IONIC styles for my app instead of writing my own.
No not really. The closest thing that could be implemented would be to use a React Native WebView and render ionic css styling in the WebView, but it would be pretty complex for not a lot of payoff.
A lot of the built in styling that Ionic comes with is iOS and Android specific, matching the iOS and Android native apis and components. React Native also does this out of the box, so many components (Picker, DatePicker, AlertIOS, ProgressBarAndroid, TabBariOS, etc...) will already have platform specific styling similar to Ionic. The Ionic button styling, cards, etc can be custom built in React Native thought without a ton of effort.

Can React Native app (means same codebase) be turned into mobile web app?

Whether the same REACT codebase can be shared across mobile web and mobile app?
Unfortunately, you cannot. React Native uses a bunch of pre-built components that are really just native iOS components wrapped in Javascript. For example, you could use <div> or <span> in React but in React Native you'd have to use <Text>, images can only be displayed in <Image> components, etc. There are also stricter limitations on what styles, data, or nested components each React Native component can have.
On a side note, trying to do this goes against the React philosphy -> 'Learn once, write anywhere'. You can try taking a look at Ionic if you're interested in something that ports easily over to mobile apps.

Resources