1 / 3

What are the primary distinctions between ReactJS and React-Native

React-Native has been around for about two years and has evolved into a really intriguing framework since it can be used for Android and allows us to create cross-platform mobile apps. A few volunteers have modified the framework to allow them to create desktop programmes for Mac and Windows, which is quite exciting.

Télécharger la présentation

What are the primary distinctions between ReactJS and React-Native

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. What are the primary distinctions between ReactJS and React-Native? What I've learnt while developing web and mobile apps using React React-Native has been around for about two years and has evolved into a really intriguing framework since it can be used for Android and allows us to create cross-platform mobile apps. A few volunteers have modified the framework to allow them to create desktop programmes for Mac and Windows, which is quite exciting. In some ways, React-Native development is comparable to ReactJS development services, but there are certain distinctions to be aware of before beginning your first native project. In this blog, I'll go through the key differences I've noticed as a ReactJS web developer who learnt to use React-Native and created a few native apps with it. Setup and packaging React-Native is a framework, whereas ReactJS is a javascript library that you may use to build a website. When you start a new ReactJS project, you'll most likely use a bundler like Webpack and try to figure out which bundling modules you'll require. React-Native includes everything you need, and you probably won't need anything else. When you begin a new project, you will note how simple it is to set up: it is really fast and only requires one command line to run in the terminal before you are ready to proceed. You may instantly begin creating your first native app utilising ES6, some ES7 capabilities, and even a few polyfills. You will need Xcode (for iOS, exclusively on Mac) or Android Studio (for Android) installed on your computer to run your programme. You have the option of running it on a platform simulator/emulator or directly on your own devices. Styling and DOM React-Native does not utilise HTML to render the app, but instead offers alternative components that function similarly. These React-Native components represent the actual native iOS or Android UI components that are rendered in the app. Because your code isn't presented in an HTML page, you won't be able to reuse any libraries you previously used with ReactJS to render HTML, SVG, or Canvas. Although there may be more libraries for React-Native, react.parts offers a Native category where you may locate what you need. Stylesheets in Javascript will be required to style your React-Native components. It appears to be CSS, but it is not precisely the same. This can be rather puzzling at first, and you may question how you can construct mixins like in SASS, or how you can override the style of a component you wish to reuse. Then you realise React-Native is not built with web components and cannot be styled in the same manner. Fortunately, you will most likely be able to locate alternate answers to your problem. I'm not sure about you, but despite the fact that Flexbox has been available for a while, I've never been thoroughly immersed in its use, primarily because the projects I was engaged with required backward compatibility with earlier browsers. Flexbox is the best approach to create a properly responsive app with React-Native. It can be difficult at first since it does not always act like CSS, but if you have a fundamental knowledge, you will rapidly become proficient. To understand more about it, I recommend reading this article: Understanding React Native flexbox layout.

  2. Gestures and Animations CSS animations, farewell! You'll have to learn an entirely new approach to animate the various components of your app with Javascript while using React-Native. The Animated API supplied by React-Native is the recommended method for animating a component. It is comparable to the well-known Javascript package Velocity.js. It enables the creation of several forms of animations, either timed or based on a velocity related with a motion, and may be used with various types of Easing. Overall, you can do almost any type of animation that you would do on the web. React-Native also has LayoutAnimation, which is incredibly amazing and simple to use for transitions but currently only works for iOS because Android does not support it well. To interact with user motions, React-Native provides the PanResponder, which is analogous to the Javascript touch events web API. Getting it up and going might be frustrating, but you'll soon realise it's not that difficult. To enable the touch handler on this View, the PanResponder must be applied to a View (or Text or Image) of your component. The PanResponder then gives a number of methods you can use to capture the various touch events, such as onPanResponderGrant (touchstart), onPanResponderMove (touchmove), or onPanResponderRelease (touchrelease) (touchend). These routines provide access to the native event and gesture state, which contain information such as all touches and their positions, as well as cumulative distance, velocity, and touch origin. The primary challenge with the PanResponder, in my opinion, arises when you have nested views/components, each with its own PanResponder, and you must select which one should be allowed control of the gesture. This article can help you learn more about Animated and the PanResponder: PanResponder-powered React-native Animated API. Tools for developers When you start a new native project, React provides you with a few developer tools right out of the box, which is really cool in my opinion. Hot reloading is possible and is ideal for making minor changes to the styles of your app. For larger changes that affect the app's functionality, I typically prefer to utilise Live Reload, which completely reloads your app as you make a change in the code. Publishing If you are developing an app for both iOS and Android, you will need to learn how to use Xcode and Android Studio to ensure that everything is correctly set up before releasing your app to the App Store or Google Play. It works exactly like a typical native app for iOS, however on Android, you must follow the React suggestion to sign your APK before publishing it to Google Play. If you miss being able to publish an update to your native app with a single command line, as you would with a web app and a properly configured VCS, you can use the awesome Code Push to deploy code directly to the user, without the need for archiving, sending your app to the store, and waiting for it to be ready. Code Push is helpful for making minor enhancements or bug fixes, but it is not advised for adding totally new features. Finishing up Today, I'm really enjoying using React-Native for developing. I've been using it for a little less than a year now, and it's insanely quick to get an app up and running! You can create complicated UI as rapidly as you can with ReactJS development, and it typically works well for both iOS and Android. The transition from ReactJS to React-Native is, in my opinion, pretty simple, especially if you enjoy learning new Javascript frameworks; it's simply a different approach to utilise React.

  3. The community surrounding React-Native is expanding rapidly, the technology is not going away anytime soon, and I would strongly advise any web developer who wants to create a mobile app to abandon Cordova and give it a try.

More Related