<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Umang Darji</title>
    <description>The latest articles on Forem by Umang Darji (@bunyy).</description>
    <link>https://forem.com/bunyy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F224830%2F00822dfe-2f94-46a5-814d-fde91666d0eb.jpeg</url>
      <title>Forem: Umang Darji</title>
      <link>https://forem.com/bunyy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/bunyy"/>
    <language>en</language>
    <item>
      <title>Firebase analytics in React native app</title>
      <dc:creator>Umang Darji</dc:creator>
      <pubDate>Sun, 29 Mar 2020 18:23:13 +0000</pubDate>
      <link>https://forem.com/enappd/firebase-analytics-in-react-native-app-1dkn</link>
      <guid>https://forem.com/enappd/firebase-analytics-in-react-native-app-1dkn</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;In this post, you’ll learn how to implement the easy to integrate Firebase Analytics in React Native apps.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete code of this post can be found in the Github repository &lt;/strong&gt;&lt;a href="https://github.com/enappd/AnalyticsData.git" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;react-native-firebase-analytics&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;What is analytics&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Analysis&lt;/strong&gt; is focused on understanding the past; what happened and why it happened. Analytics focuses on why it happened and what will happen next.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Analytics&lt;/strong&gt; is a free app measurement solution that provides insight on app usage and user engagement.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Organizations may apply analytics to business data to describe, predict, and improve business performance. Specifically, areas within analytics include &lt;a href="https://en.wikipedia.org/wiki/Predictive_analytics" class="markup--anchor markup--p-anchor" title="Predictive analytics" rel="noopener"&gt;predictive analytics&lt;/a&gt;, &lt;a href="https://en.wikipedia.org/wiki/Prescriptive_analytics" class="markup--anchor markup--p-anchor" title="Prescriptive analytics" rel="noopener"&gt;prescriptive analytics&lt;/a&gt;, &lt;a href="https://en.wikipedia.org/wiki/Enterprise_decision_management" class="markup--anchor markup--p-anchor" title="Enterprise decision management" rel="noopener"&gt;enterprise decision management&lt;/a&gt;, descriptive analytics, cognitive analytics, Big Data Analytics, retail analytics, supply chain analytics, store assortment and &lt;a href="https://en.wikipedia.org/wiki/Stock-keeping_unit" class="markup--anchor markup--p-anchor" title="Stock-keeping unit" rel="noopener"&gt;stock-keeping unit&lt;/a&gt; optimization, marketing optimization and &lt;a href="https://en.wikipedia.org/wiki/Marketing_mix_modeling" class="markup--anchor markup--p-anchor" title="Marketing mix modeling" rel="noopener"&gt;marketing mix modeling&lt;/a&gt;, &lt;a href="https://en.wikipedia.org/wiki/Web_analytics" class="markup--anchor markup--p-anchor" title="Web analytics" rel="noopener"&gt;web analytics&lt;/a&gt;, call analytics, &lt;a href="https://en.wikipedia.org/wiki/Speech_analytics" class="markup--anchor markup--p-anchor" title="Speech analytics" rel="noopener"&gt;speech analytics&lt;/a&gt;, sales force sizing and optimization, price and promotion modeling, predictive science, credit &lt;a href="https://en.wikipedia.org/wiki/Risk_analysis_%28business%29" class="markup--anchor markup--p-anchor" title="Risk analysis (business)" rel="noopener"&gt;risk analysis&lt;/a&gt;, and &lt;a href="https://en.wikipedia.org/wiki/Fraud_detection" class="markup--anchor markup--p-anchor" title="Fraud detection" rel="noopener"&gt;fraud analytics&lt;/a&gt;. Since analytics can require extensive computation (see &lt;a href="https://en.wikipedia.org/wiki/Big_data" class="markup--anchor markup--p-anchor" title="Big data" rel="noopener"&gt;big data&lt;/a&gt;), the algorithms and software used for analytics harness the most current methods in computer science, statistics, and mathematics&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Why is analytics important?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Internet marketing without analytics is like pointing at NYC and saying “the building is somewhere in there.” Internet marketing with analytics is akin to pinpointing the exact location of a specific building using satellite technology.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Analytics&lt;/strong&gt; allow you to quantify the effects of making a change to your marketing strategy, and that’s invaluable to the process of improving and optimizing online marketing campaigns. The biggest benefit of utilizing proper &lt;strong class="markup--strong markup--p-strong"&gt;analytics&lt;/strong&gt; is being able to identify strengths and weaknesses.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Analytics&lt;/strong&gt; essentially allow for a defined path of optimization that leads to better results on all fronts.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is React-Native&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;TLDR;&lt;/strong&gt; — React Native (RN) apps are more “native” than webview apps made by Cordova / Ionic. But React Native is yet to release a stable (1.0.0_) version of the framework.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native is a JavaScript framework for writing natively rendering mobile applications. It’ is based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. Because most of the code you write can be shared between platforms, React Native makes it easy to simultaneously develop for both Android and iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native applications render using real mobile UI components, &lt;em class="markup--em markup--p-em"&gt;not&lt;/em&gt; webviews, and will look and feel like any other native mobile application. React Native also exposes JavaScript interfaces for platform APIs, so your React Native apps can access platform features like the phone camera, or the user’s location. &lt;a href="http://bit.ly/1YipO7A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Facebook&lt;/a&gt;, &lt;a href="http://bit.ly/1PPEiZH" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Palantir&lt;/a&gt;, &lt;a href="http://bit.ly/1PPEjNg" class="markup--anchor markup--p-anchor" rel="noopener"&gt;TaskRabbit&lt;/a&gt; etc are already using it in production for user-facing applications.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--aCmYfK0i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A8sJrsHqZSsLJ3UVBtuUGRA.jpeg"&gt;&lt;br&gt;React Native&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Firebase&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Firebase is a Backend-as-a-Service (BaaS) platform. It started as a &lt;a href="http://blog.ycombinator.com/firebase-yc-s11-raises-5-dollars-dot-6m-series-a-from-union-square-ventures-and-flybridge" class="markup--anchor markup--p-anchor" rel="noopener"&gt;YC11 startup&lt;/a&gt; and grew up into a next-generation app-development platform on Google Cloud Platform. It is getting popular by the day because of the ease of integration and a variety of functionalities available on it.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Some of the quick integrations available with Firebase are&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Email Authentication&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Social logins&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Real-time database&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;Analytics&lt;/strong&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Crashlytics&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Push notifications&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;In-app messages&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Remote config&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;and much more. Firebase is quickly growing to become the most popular mobile app back-end platform.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Enough of story-telling, let’s dive into — how to implement analytics in React Native apps&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Structure&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;I will go ahead in step-by-step fashion so you can follow easily.&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Create a Firebase project and find analytics options&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Create a basic React Native app&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Running the app on a device&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Install firebase analytics dependency&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Implement analytics in your app&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Send analytics event from app to firebase dashboard&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Check this event on Firebase dashboard.&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;So let’s dive right in!&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ruG-Ui9w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AHfUjPCVB8Eer3q22lcuoew.gif"&gt;&lt;br&gt;Ouch! Let’s ….. not dive&lt;h3 class="graf graf--h3 graf-after--figure"&gt;1. Create a Firebase project and find analytics options&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Go to &lt;a href="https://console.firebase.google.com/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Firebase&lt;/a&gt; and create your first project (or use an existing one). Your console should look like this&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s---WFFMV5W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AQ1tzpM83Uq66TNZ9E28nYA.png"&gt;&lt;br&gt;Your Firebase projects all in one place&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Note&lt;/strong&gt; — It’s really easy to create a Firebase project, but if you still face any issue, follow step 1–4 of &lt;a href="https://enappd.com/blog/how-to-integrate-firebase-in-ionic-4-apps/23/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;this blog&lt;/a&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Click on your project and you’ll enter the project’s dashboard. Look for the &lt;strong class="markup--strong markup--p-strong"&gt;Analytics&lt;/strong&gt; tab. This is where the magic will happen!&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--wCAdKccU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2Anetbb70MBgLb3EsUzO6e8g.png"&gt;&lt;br&gt;Analytics dashboard&lt;p class="graf graf--p graf-after--figure"&gt;For setting up options, you’ll first have to create an Android app in Firebase console.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--uyyEZC5E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AkZaRFHlVlWW03I_2XC6F5g.png"&gt;&lt;br&gt;Add a new Android app in Firebase&lt;p class="graf graf--p graf-after--figure"&gt;During the process, it will ask you to enter app’s &lt;strong class="markup--strong markup--p-strong"&gt;package name&lt;/strong&gt; and provide &lt;strong class="markup--strong markup--p-strong"&gt;google-services.json. &lt;/strong&gt;Make sure you keep the package name same as what you are setting in &lt;code class="markup--code markup--p-code"&gt;config.xml&lt;/code&gt; of your app. (If we create a new project called “&lt;strong class="markup--strong markup--p-strong"&gt;HelloWorld&lt;/strong&gt;” using react native CLI, by default package name for android project will be “&lt;strong class="markup--strong markup--p-strong"&gt;com.helloworld&lt;/strong&gt;” and default bundle identifier for iOS app will be “&lt;strong class="markup--strong markup--p-strong"&gt;org.reactjs.native.example.HelloWorld&lt;/strong&gt;”., don’t use the default package name)&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--Vp3fbafD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2Artd51fTn_frvjGxUEkhiow.png"&gt;&lt;br&gt;Download google-services.json&lt;h3 class="graf graf--h3 graf-after--figure"&gt;2. Create a basic React Native app&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;First, make sure you have all pre-requisites to create a react-native app as per the &lt;a href="https://facebook.github.io/react-native/docs/getting-started.html" class="markup--anchor markup--p-anchor" rel="noopener"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;At the time of this post, I have React-Native version 0.60&lt;/strong&gt;&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Create a blank react-native app (Replace &lt;code class="markup--code markup--p-code"&gt;myApp&lt;/code&gt; with your own name)&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;$ react-native init myApp&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;This will create a basic React-native app which you can run in a device or simulator. (either Android or iOS)&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 3: Running the app on a device&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;To run the iOS app, you should specify simulator&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;react-native run-ios --simulator=”iPhone X”&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;To run Android app, you should start emulator first, either via Android Studio or &lt;code class="markup--code markup--p-code"&gt;adb&lt;/code&gt; , then call&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;react-native run-android&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;You’ll see the default start screen&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--UIavk9-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2ATnZfGsKdsWGBUac-0YutpA.jpeg"&gt;&lt;br&gt;Default start screen for React Native app&lt;h3 class="graf graf--h3 graf-after--figure"&gt;4. Install firebase analytics dependency&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Install this module with Yarn:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;yarn add @react-native-firebase/analytics&lt;br&gt;yarn add &lt;/code&gt;@react-native-firebase/app&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Need to install the module manually? Follow this guide installation guides.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;strong class="markup--strong markup--h4-strong"&gt;Android:-&lt;/strong&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;The following steps are only required if you are using React Native &amp;lt;= 0.59 or need to manually integrate the library.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Update Gradle Settings&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Add the following to your projects &lt;code class="markup--code markup--p-code"&gt;/android/settings.gradle&lt;/code&gt; file:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;include ':@react-native-firebase_analytics'&lt;br&gt;project(':@react-native-firebase_analytics').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/analytics/android')&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Update Gradle Dependencies&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Add the React Native Firebase module dependency to your &lt;code class="markup--code markup--p-code"&gt;/android/app/build.gradle&lt;/code&gt; file:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;dependencies {&lt;br&gt;...&lt;br&gt;implementation project(path: ":@react-native-firebase_analytics")&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Add package to the Android Application&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p is-selected"&gt;Import and apply the React Native Firebase module package to your &lt;code class="markup--code markup--p-code"&gt;/android/app/src/main/java/**/MainApplication.java&lt;/code&gt; file:&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Import the package:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;import io.invertase.firebase.analytics.ReactNativeFirebaseAnalyticsPackage;&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Add the package to the registry:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;protected List&amp;lt;ReactPackage&amp;gt; getPackages() {&lt;br&gt;return Arrays.asList(&lt;br&gt;new MainReactPackage(),&lt;br&gt;new ReactNativeFirebaseAnalyticsPackage(),&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Rebuild the project&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Once the above steps have been completed, rebuild your Android project:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;react-native run-android&lt;/code&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;&lt;strong class="markup--strong markup--h4-strong"&gt;iOS:-&lt;/strong&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;The following steps are only required if you are using React Native &amp;lt;= 0.59 or need to manually integrate the library.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Installation can be done via CocoaPods (recommended) or via Frameworks:&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;1. CocoaPods Installation&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Add the RNFBAnalytics Pod&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Add the &lt;code class="markup--code markup--p-code"&gt;RNFBAnalytics&lt;/code&gt; Pod to your projects &lt;code class="markup--code markup--p-code"&gt;/ios/Podfile&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;target 'app' do&lt;br&gt;...&lt;br&gt;pod 'RNFBAnalytics', :path =&amp;gt; '../node_modules/@react-native-firebase/analytics/ios'&lt;br&gt;end&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Update Pods &amp;amp; rebuild the project&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;You may need to update your local Pods in order for the &lt;code class="markup--code markup--p-code"&gt;RNFBAnalytics&lt;/code&gt; Pod to be installed in your project:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;$ cd /ios/&lt;br&gt;$ pod install --repo-update&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Once the Pods have installed locally, rebuild your iOS project:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;react-native run-ios&lt;/code&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;2. Manual Framework Installation&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;If your environment does not have access to Cocopods, it is still possible to install the project via Frameworks.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;TODO&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Device Identification&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;If you would like to enable Firebase Analytics to generate automatic audience metrics for iOS (as it does by default in Android), you must link additional iOS libraries, &lt;a href="https://support.google.com/firebase/answer/6318039" class="markup--anchor markup--p-anchor" rel="noopener"&gt;as documented by the Google Firebase team&lt;/a&gt;. Specifically you need &lt;code class="markup--code markup--p-code"&gt;libAdIdAccess.a&lt;/code&gt; and &lt;code class="markup--code markup--p-code"&gt;AdSupport.framework&lt;/code&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The way to do this using Cocoapods is to add this to your Podfile (though please use &lt;a href="https://cocoapods.org/pods/GoogleIDFASupport" class="markup--anchor markup--p-anchor" rel="noopener"&gt;the most current Pod version&lt;/a&gt; supported by react-native-firebase):&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;ios/Podfile&lt;/strong&gt;&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;// ..&lt;br&gt;target 'app' do&lt;br&gt;// ..&lt;br&gt;pod 'RNFBAnalytics', :path =&amp;gt; '../node_modules/@react-native-firebase/analytics/ios'&lt;br&gt;pod 'GoogleIDFASupport', '~&amp;gt; 3.14.0'&lt;br&gt;end&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;5. Implement analytics in your app&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;The Analytics package will automatically start tracking events such as when users clear app data, dismiss notifications and more. To view the full list of automatic events, see &lt;a href="https://support.google.com/firebase/answer/6317485" class="markup--anchor markup--p-anchor" rel="noopener"&gt;this page&lt;/a&gt; of the official Firebase documentation.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The package also provides a JavaScript API to allow for logging custom events and metrics throughout your application.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Import the Cloud Functions package into your project:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;import analytics from '@react-native-firebase/analytics';&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;The package also provides access to the firebase instance:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;import { firebase } from '@react-native-firebase/analytics';&lt;/code&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;Custom events&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;To log a custom event, use the &lt;code class="markup--code markup--p-code"&gt;logEvent&lt;/code&gt; method:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import analytics from '&lt;a href="http://twitter.com/react" class="markup--anchor markup--pre-anchor" title="Twitter profile for @react"&gt;@react&lt;/a&gt;-native-firebase/analytics';&lt;br&gt;async function onProductView() {&lt;br&gt;     await analytics().logEvent('product_view', {&lt;br&gt;                 id: '123456789',&lt;br&gt;                 color: 'red', &lt;br&gt;                 via: 'ProductCatalog',&lt;br&gt;      });&lt;br&gt;}&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;Attaching user data&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;User data can be attached to analytical events via the &lt;code class="markup--code markup--p-code"&gt;&lt;a href="https://invertase.io/oss/react-native-firebase/v6/analytics/reference/module#setUserId" class="markup--anchor markup--p-anchor" rel="noopener"&gt;setUserId&lt;/a&gt;&lt;/code&gt;, &lt;code class="markup--code markup--p-code"&gt;&lt;a href="https://invertase.io/oss/react-native-firebase/v6/analytics/reference/module#setUserProperties" class="markup--anchor markup--p-anchor" rel="noopener"&gt;setUserProperties&lt;/a&gt;&lt;/code&gt; and &lt;code class="markup--code markup--p-code"&gt;&lt;a href="https://invertase.io/oss/react-native-firebase/v6/analytics/reference/module#setUserProperty" class="markup--anchor markup--p-anchor" rel="noopener"&gt;setUserProperty&lt;/a&gt;&lt;/code&gt; methods. Each Firebase project can have up to 25 uniquely named (case-sensitive) user properties.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import analytics from '&lt;a href="http://twitter.com/react" class="markup--anchor markup--pre-anchor" title="Twitter profile for @react"&gt;@react&lt;/a&gt;-native-firebase/analytics';&lt;br&gt;async function onSignIn(user) {&lt;br&gt; await Promise.all([&lt;br&gt;   analytics().setUserId(user.uid),&lt;br&gt;   analytics().setUserProperty('account_balance', user.balance),&lt;br&gt; ]);&lt;br&gt;}&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;Tracking screen names&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Similar to Analytics on the web, it’s important to understand the user’s journey within your application, for example, tracking drop off points during an e-commerce transaction flow. The Analytics package provides a method called &lt;code class="markup--code markup--p-code"&gt;setCurrentScreen&lt;/code&gt; to help track this.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import React, { useEffect } from 'react';&lt;br&gt;import { View } from 'react';&lt;br&gt;import analytics from '&lt;a href="http://twitter.com/react" class="markup--anchor markup--pre-anchor" title="Twitter profile for @react"&gt;@react&lt;/a&gt;-native-firebase/analytics';&lt;br&gt;function BasketScreen() {&lt;br&gt;async function trackScreenView(screen) {&lt;br&gt;    // Set &amp;amp; override the MainActivity screen name&lt;br&gt;    await analytics().setCurrentScreen(screen, screen);&lt;br&gt;}&lt;br&gt;// Track a screen view once the component has mounted&lt;br&gt;useEffect(() =&amp;gt; {&lt;br&gt;    trackScreenView('BasketScreen');&lt;br&gt;}, []);&lt;br&gt;  return &amp;lt;View /&amp;gt;;&lt;br&gt;}&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;Resetting analytics data&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;In some cases, resetting all analytics data is required on certain events such as signing out of the application. To achieve this call the &lt;code class="markup--code markup--p-code"&gt;resetAnalyticsData&lt;/code&gt; method.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import analytics from '&lt;a href="http://twitter.com/react" class="markup--anchor markup--pre-anchor" title="Twitter profile for @react"&gt;@react&lt;/a&gt;-native-firebase/analytics';&lt;br&gt;async function onSignOut() {&lt;br&gt;    await analytics().resetAnalyticsData();&lt;br&gt;}&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;Reserved Events&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;The Analytics package works out of the box, however a number of events are automatically reported to Firebase. These event names are called as ‘Reserved Events’. Attempting to send any custom event using the &lt;code class="markup--code markup--p-code"&gt;logEvent&lt;/code&gt; method with any of the following event names will throw an error.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Reserved event list&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;code class="markup--code markup--li-code"&gt;app_clear_data&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;app_uninstall&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;app_update&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;error&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;first_open&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;first_visit&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;first_visit&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;first_open_time&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;first_visit_time&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;in_app_purchase&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;in_app_purchase&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;notification_dismiss&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;notification_foreground&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;notification_open&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;notification_receive&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;os_update&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;session_start&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;screen_view&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;user_engagement&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;ad_impression&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;ad_click&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;ad_query&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;ad_exposure&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;adunit_exposure&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;ad_activeiew&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;6. Send analytics event from app to firebase dashboard&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Prepare a simple event from our app and send it to all Firebase console. For sending app event to dashboard I am just creating one component named it &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Analytics.js&lt;/strong&gt;&lt;/code&gt;&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Import this component to your &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;app.js&lt;/strong&gt;&lt;/code&gt; File like this.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--0E0Amk4L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A5qY47XxItaWIYiF4AIuwDw.jpeg"&gt;&lt;br&gt;analytics screen&lt;p class="graf graf--p graf-after--figure"&gt;We have added three buttons here for three events&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Custom Event&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Set User Event&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Reset Analytics Data Event&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;So when you click on any of these buttons you can your app events recorded in Firebase dashboard.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;7. Check this event on Firebase dashboard.&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Attention: if the app is running with &lt;code class="markup--code markup--p-code"&gt;-FIRDebugEnabled&lt;/code&gt; it shouldn't take more than a few seconds for events to start appearing on the DebugView.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Dashboard View:-&lt;/h4&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--6tOsn6No--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AQD9ovLuzaIQvwYuSpvjr3A.png"&gt;&lt;br&gt;Analytics Dashboard View&lt;h4 class="graf graf--h4 graf-after--figure"&gt;Event View:-&lt;/h4&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--NzoinC6Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2ANoUairmsrso6OIEzcelotQ.png"&gt;&lt;h4 class="graf graf--h4 graf-after--figure"&gt;Event Details View:-&lt;/h4&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--UBKpT9GY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AvRHpI6_IJd6jvG8DNxMwIw.png"&gt;&lt;br&gt;Event Details view&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this post, we learnt how to implement Analytics using Firebase in React native apps. We also learnt how to handle different types of actions and see their data in the dashboard.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete code of this post can be found in the Github repository &lt;/strong&gt;&lt;a href="https://github.com/enappd/AnalyticsData.git" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;react-native-firebase-analytics&lt;/strong&gt;&lt;/a&gt;&lt;a href="https://github.com/enappd/ionic-4-in-app-purchase" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;(master branch)&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learnt about setting up Analytics in React Native apps, here are some other topics you can look into&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Firebase — &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Integrate Firebase&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Push notifications&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Firebase CRUD&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To in React Native — &lt;a href="https://enappd.com/blog/geolocation-geocoding-react-native-apps/84" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/pick-images-from-camera-gallery-in-react-native-app/78" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Redux implementation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-make-api-calls-in-react-native-apps/125" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Make API calls&lt;/a&gt; | &lt;a href="https://enappd.com/blog/navigations-in-react-native-app/124" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Navigation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-translate-in-react-native-app-globalization-internationalization-and-text-to-speech/120" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Translation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-qr-code-scanning-using-react-native-camera/117" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Barcode &amp;amp; QR code scan&lt;/a&gt; | &lt;a href="https://enappd.com/blog/send-read-and-delete-sms-in-react-native/107" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Send &amp;amp; Read SMS&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-vision-with-react-native/96" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Vision&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Payments — &lt;a href="https://enappd.com/blog/implement-apple-pay-in-react-native-apps/93" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/stripe-integration-in-react-native-apps-using-firebase/108" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe payments&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Authentication — &lt;a href="https://enappd.com/blog/google-login-in-react-native-android-apps-with-firebase/90" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Google Login&lt;/a&gt;| &lt;a href="https://enappd.com/blog/facebook-login-in-react-native-apps/89" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Facebook login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Phone Auth&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-react-native-apps-using-firebase/95" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/anonymous-login-in-react-native-apps-with-firebase/129" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous Login&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-make-stories-ui-like-instagram-and-whatsapp-in-react-native/123" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Instagram / Whatsapp Story Feature in React Native&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;React Native life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Implement Redux&lt;/a&gt; | &lt;a href="https://enappd.com/blog/async-actions-with-redux-thunk-middleware-in-react-native-apps-1/100" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Async actions with Redux&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/guide-on-react-native-full-app/53" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next React Native app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/react-native-full-app/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CF89hkbC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AsWyEeAfCMk7ULOkLUCdSug.jpeg"&gt;&lt;br&gt;React Native Full App

</description>
      <category>reactnative</category>
      <category>firebase</category>
      <category>analytics</category>
    </item>
    <item>
      <title>Difference between Redux and Flux</title>
      <dc:creator>Umang Darji</dc:creator>
      <pubDate>Sun, 29 Mar 2020 17:35:25 +0000</pubDate>
      <link>https://forem.com/enappd/difference-between-redux-and-flux-5ehe</link>
      <guid>https://forem.com/enappd/difference-between-redux-and-flux-5ehe</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;In this post, we’ll try to compare — Flux and Redux. Both technologies &lt;strong class="markup--strong markup--p-strong"&gt;allow you to manage state in your app. &lt;/strong&gt;Both&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;are a great tool because they allow developers to quickly &lt;strong class="markup--strong markup--p-strong"&gt;store&lt;/strong&gt; and &lt;strong class="markup--strong markup--p-strong"&gt;manage&lt;/strong&gt; state in his app.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;a href="https://redux.js.org/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt;&lt;/a&gt; is a standalone state management library, which can be used with any library or framework. If your background is &lt;strong class="markup--strong markup--p-strong"&gt;React developer&lt;/strong&gt;, then you have used the &lt;strong class="markup--strong markup--p-strong"&gt;Redux library with React&lt;/strong&gt;. The primary use of &lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt; is that we can use one application state as a global state and interact with the state from any react component is very easy whether they are siblings or parent-child.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--v_kUprvc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AkwMieaTmikxMDhZfI-yeaw.png"&gt;&lt;br&gt;Redux Logo&lt;blockquote class="graf graf--blockquote graf-after--figure"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Basic usage of Redux comes into picture when the app gets large and complex. In such apps, simple data management as parent-child becomes difficult using &lt;/strong&gt;&lt;code class="markup--code markup--blockquote-code"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;props&lt;/em&gt;&lt;/strong&gt;&lt;/code&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;. There are multiple components trying to communicate with multiple other components. In such cases, Redux comes in handy.&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Redux can be broken down into few sections while building the application which is listed below.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Actions: “&lt;/strong&gt;are payloads of information that send data from your application to your store. They are the &lt;em class="markup--em markup--p-em"&gt;only&lt;/em&gt; source of information for the store.” this means if any state change necessary the change required will be dispatched through the actions.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Reducers: “&lt;/strong&gt;Actions&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;describe the fact that &lt;em class="markup--em markup--p-em"&gt;something happened&lt;/em&gt;, but don’t specify how the application’s state changes in response. This is the job of reducers.” when an action is dispatched for state change its the reducers duty to make the necessary changes to the state and return the new state of the application.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Store: &lt;/strong&gt;with help of reducers a store can be created which holds the entire state of the application it is recommended to use a single store for the entire application than having multiple stores which will violate the use of redux which only has a single store.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Components (UI): &lt;/strong&gt;This&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;is where the UI of the application is kept.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Middlewares&lt;/strong&gt;: middleware can be used for a variety of things, including asynchronous API calls. Middleware sounds much more complicated than it really is. The only way to really understand middleware is to see how the existing middleware works and try to write your own.we will cover middleware in the next blog.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ac30qLMK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A2--d_JqkSBPUBIe_TsppPA.jpeg"&gt;&lt;br&gt;Redux workflow in simple schematic&lt;h3 class="graf graf--h3 graf-after--figure"&gt;What is the Flux?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Flux is a Javascript architecture or pattern for UI which runs on unidirectional data flow and has a centralized dispatcher. It is useful when your project has dynamic data and you need to keep the data updated in an effective manner. It was created by Facebook and complements React as view. This model is used to ease maintenance. It has three primary components: Views, Stores, and Dispatcher. As the MVC application grows, we find many numbers of views as models, which are all talking to each other, making it difficult to manage and debug.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--KWa0-u_I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AckGBd5Sn8jzaQOFrpD9-og.png"&gt;&lt;br&gt;Flux logo&lt;p class="graf graf--p graf-after--figure"&gt;Flux is more of a pattern than a framework and does not have any hard dependencies. However, we often use &lt;a href="https://nodejs.org/api/events.html#events_class_events_eventemitter" class="markup--anchor markup--p-anchor" rel="nofollow noopener noopener"&gt;EventEmitter&lt;/a&gt; as a basis for &lt;code class="markup--code markup--p-code"&gt;Stores&lt;/code&gt; and &lt;a href="https://github.com/facebook/react" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React&lt;/a&gt; for our &lt;code class="markup--code markup--p-code"&gt;Views&lt;/code&gt;. The one-piece of Flux not readily available elsewhere is the &lt;code class="markup--code markup--p-code"&gt;Dispatcher&lt;/code&gt;. This module, along with some other utilities, is available here to complete your Flux toolbox.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Flux can be broken down into few sections while building the application which is listed below.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Actions: “&lt;/strong&gt;are payloads of information that send data from your application to your store. They are the &lt;em class="markup--em markup--p-em"&gt;only&lt;/em&gt; source of information for the store.” this means if any state change necessary the change required will be dispatched through the actions.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;dispatcher&lt;/strong&gt;: The dispatcher is a singleton, and operates as the central hub of data flow in a Flux application. It is essentially a registry of callbacks, and can invoke these callbacks in order. Each &lt;em class="markup--em markup--p-em"&gt;store&lt;/em&gt; registers a callback with the dispatcher. When new data comes into the dispatcher, it then uses these callbacks to propagate that data to all of the stores. The process of invoking the callbacks is initiated through the dispatch() method, which takes a data payload object as its sole argument.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Store: &lt;/strong&gt;In Flux, Stores are simply a place where data is read out from. More specifically, Views within a Flux architecture will be notified of changes within Stores via the &lt;a href="https://en.wikipedia.org/wiki/Observer_pattern" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Observer pattern&lt;/a&gt;, and then query for those data in order to update their own states.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;View&lt;/strong&gt; : This&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;is where the UI of the application is kept.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--7DLs2utz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A7qtRmuWoMmFyhpnyxoS3MA.png"&gt;&lt;br&gt;Flux Work Flow&lt;pre class="graf graf--pre graf-after--figure"&gt;&lt;code class="markup--code markup--pre-code"&gt;const someAction = {&lt;br&gt;  type: "Test",&lt;br&gt;  payload: {user: "Test User", age: 25},&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;This is a generally accepted convention to have a type and a payload for an action. The payload can be any valid JS type (array, object, etc ).&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Top 10 Attributes to Consider While Selecting the State Management tool for any website.&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;To decide which one is better for State Management, lets first define the attributes based on which we will compare all of the above. And, these are:&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Developed By&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Stable Release&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Initial Release&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Github Stats&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Store&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Dispatcher&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;State&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Workflow&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Final Words (Pros and cons)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;Developed By:-&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Redux was created by &lt;strong class="markup--strong markup--p-strong"&gt;Dan Abramov&lt;/strong&gt; and &lt;strong class="markup--strong markup--p-strong"&gt;Andrew Clark&lt;/strong&gt;. Abramov began writing the first Redux implementation while preparing for a conference talk at React Europe on hot reloading.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Flux was created by &lt;strong class="markup--strong markup--p-strong"&gt;Facebook&lt;/strong&gt; For forcing an unidirectional flow of data between a system’s components.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Initial Release:-&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Redux:- 2, June 2015&lt;br&gt;Flux:- June 2011&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Stable Release:-&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Redux:- 4.0.0 in April 2017&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The major changes in the stable release are around our TypeScript definitions, bundled CommonJS and ES builds, throwing if you subscribe or getState from a reducer, and a bunch of other smaller things. The full changes are listed below.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Flux:- 3.1.3 on Nov 2016&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The major changes in the stable release are added support for React 16&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Github Stats:-&lt;/h3&gt;
&lt;h4 class="graf graf--h4 graf-after--h3"&gt;Flux:-&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Github Stars&lt;/strong&gt;:- 16331&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Contributors&lt;/strong&gt;:- 114&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Total commits&lt;/strong&gt;:- 394&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Total open issues&lt;/strong&gt;:-10&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Total Closed Issues&lt;/strong&gt;:-216&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;React:-&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Github Stars&lt;/strong&gt;:- 50499&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Contributors&lt;/strong&gt;:- 698&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Total commits&lt;/strong&gt;:- 2094&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Total open issues:-&lt;/strong&gt;27&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Total Closed Issues&lt;/strong&gt;:-1648&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Store:-&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;With &lt;strong class="markup--strong markup--p-strong"&gt;Flux&lt;/strong&gt; it is a convention to have &lt;strong class="markup--strong markup--p-strong"&gt;multiple stores&lt;/strong&gt; per application; each store is a singleton object. In &lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt;, the convention is to have a &lt;strong class="markup--strong markup--p-strong"&gt;single store &lt;/strong&gt;per application, usually separated into data domains internally (you can create more than one Redux store if needed for more complex scenarios).&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flux&lt;/strong&gt;:- Multiple Store&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt;:- Single Store&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Dispatcher:-&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flux&lt;/strong&gt; has a &lt;strong class="markup--strong markup--p-strong"&gt;single&lt;/strong&gt; &lt;strong class="markup--strong markup--p-strong"&gt;dispatcher&lt;/strong&gt; and all actions have to pass through that dispatcher. It’s a singleton object. A Flux application cannot have multiple dispatchers. This is needed because a Flux application can have multiple stores and the dependencies between those stores need a single manager, which is the dispatcher.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt; has &lt;strong class="markup--strong markup--p-strong"&gt;no dispatcher&lt;/strong&gt; entity. Instead, the store has the dispatching process baked in. A Redux store exposes a few simple API functions, one of them is to dispatch actions.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;State:-&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;The other bigger constraint is that the store’s state in &lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt; cannot be &lt;strong class="markup--strong markup--p-strong"&gt;mutable&lt;/strong&gt; (or really, shouldn’t be). There is no such constraint in Flux, you can mutate the state as you wish. The state’s immutability, in Redux, is achieved easily by making the reducers pure functions (with no side effects). Redux reducers always copy the state they receive and returns a modified version of the state’s copy, not the original object itself. While this is a big constraint, it makes life much easier long term.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt;:- Immutable&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flux&lt;/strong&gt;:- Mutable&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Workflow:-&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3 is-selected"&gt;Having a similar state, action and unidirectional data flow, the Flux and Redux do have some workflow differences. Let’s understand the two technologies one-by-one.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;How Flux Functions&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Flux, in simple term, allows unidirectional data flow which is an essential part of keeping things predictable. You can understand this; you need to know how MVC architecture functions. The MVC architecture includes;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;&lt;em class="markup--em markup--p-em"&gt;Action → Controller → Models →Views&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In which Models and Views do not follow the bidirectional data flow which becomes extremely tough when complexity gets higher. There will be no clue to find exactly where the changes occur and that in result give rise to bugs.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--c8_xKMUK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2Aovem8pM12nyt2TPG"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;While unidirectional data flow abided by Flux empowers applications to avoid the shimmering effect, and the process takes place something like the diagram below;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--SPwKihN1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AvgDSI5TkgcLpT_0G"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;You may have got the precise idea of how Flux works.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;How Redux Functions&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;As Redux is predictable state container for JavaScript apps, it has actions like Flux but here it’s a simple JavaScript object while using Redux, action will turn into functions and promises. It’s a small library and has been designed with a concept to be a predictable container for application state. Flux can be implemented along with a number of frameworks while Redux works to simplify and streamline the concept of (most of) Flux.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Redux is built on the concept of;&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;&lt;em class="markup--em markup--p-em"&gt;Actions → Store → Reducers → Subscriptions&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--PoxnLYtk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AmKI6NN7F3ziJoous"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;As you can see in some cases, Flux matches the Redux. The two technologies are also similar in terms of unidirectional data flow and aligning state implying ‘type’ field.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--_BHAA7jM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A6oj0eeyO1bHWX71Gq3gQog.png"&gt;&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Final Words:-&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Flux and Redux are a very integral part of the development and it is equally important for developers to know their usages. They are a small but powerful tool which makes your applications’ user interface attractive and usable.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Some pros and cons of &lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt; and &lt;strong class="markup--strong markup--p-strong"&gt;Flux&lt;/strong&gt;&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Redux&lt;/h4&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--h4"&gt;Predictable State&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Work well with react&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Easy Debugging&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Log Everything&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Test without browser&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Hot reloading&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;State stored in a single object&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 class="graf graf--h4 graf-after--li"&gt;Flux&lt;/h4&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--h4"&gt;Unidirectional Data flow&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;No MVCopen Source&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learnt the major differences between Redux and flux for state management in your app, you can also try&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener"&gt;React Native life cycle hooks&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To integrate in React Native — &lt;a href="https://enappd.com/blog/pick-images-from-camera-gallery-in-react-native-app/78" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image picker&lt;/a&gt;| &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Integrate Firebase&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/guide-on-react-native-full-app/53" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/firebase-push-notifications-in-react-native/81/" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Firebase Push notifications in React Native Apps&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next React Native app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/react-native-full-app/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CF89hkbC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AsWyEeAfCMk7ULOkLUCdSug.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>redux</category>
      <category>flux</category>
    </item>
    <item>
      <title>Async actions with Redux Thunk middleware in React Native apps</title>
      <dc:creator>Umang Darji</dc:creator>
      <pubDate>Sat, 28 Mar 2020 14:35:39 +0000</pubDate>
      <link>https://forem.com/enappd/async-actions-with-redux-thunk-middleware-in-react-native-apps-5gi5</link>
      <guid>https://forem.com/enappd/async-actions-with-redux-thunk-middleware-in-react-native-apps-5gi5</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;This post will assist any developer to learn on how to implement async actions with the help of middleware (redux-thunk) in react native apps. We’ll approach the implementation by creating a simple application.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;em class="markup--em markup--blockquote-em"&gt;Complete source code of this tutorial is available in the &lt;/em&gt;&lt;a href="https://github.com/enappd/react-native-redux-thunk.git" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;React-native-redux-thunk-example&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;What Is React Native?&lt;/h3&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--t96EJSNq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AhVemiPgn143L4vIdAevNvw.jpeg"&gt;&lt;br&gt;React Native logo&lt;p class="graf graf--p graf-after--figure is-selected"&gt;React Native is a JavaScript framework for writing real, natively rendering mobile applications for iOS and Android. It’s based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. In other words: web developers can now write mobile applications that look and feel truly “native,” all from the comfort of a JavaScript library that we already know and love. Plus, because most of the code you write can be shared between platforms, React Native makes it easy to simultaneously develop for both Android and iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Similar to React for the Web, React Native applications are written using a mixture of JavaScript and XML markup, known as JSX. Then, under the hood, the React Native “bridge” invokes the native rendering APIs in Objective-C (for iOS) or Java (for Android). Thus, your application will render using real mobile UI components, not webviews, and will look and feel like any other mobile application. React Native also exposes JavaScript interfaces for platform APIs, so your React Native apps can access platform features like the phone camera, or the user’s location.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native currently supports both iOS and Android and has the potential to expand to future platforms as well. In this blog, we’ll cover both iOS and Android. The vast majority of the code we write will be cross-platform. And yes: you can really use React Native to build production-ready mobile applications! Some example: &lt;a href="http://bit.ly/1YipO7A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Facebook&lt;/a&gt;, &lt;a href="http://bit.ly/1PPEiZH" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Palantir&lt;/a&gt;, and &lt;a href="http://bit.ly/1PPEjNg" class="markup--anchor markup--p-anchor" rel="noopener"&gt;TaskRabbit&lt;/a&gt; are already using it in production for user-facing applications.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is Redux?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;a href="https://redux.js.org/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt;&lt;/a&gt; is a standalone state management library, which can be used with any library or framework. If your background is &lt;strong class="markup--strong markup--p-strong"&gt;React developer&lt;/strong&gt;, then you have used the &lt;strong class="markup--strong markup--p-strong"&gt;Redux library with React&lt;/strong&gt;. The primary use of &lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt; is that we can use one application state as a global state and interact with the state from any react component is very easy whether they are siblings or parent-child.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--v_kUprvc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AkwMieaTmikxMDhZfI-yeaw.png"&gt;&lt;br&gt;Redux Logo&lt;blockquote class="graf graf--blockquote graf-after--figure"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Basic usage of Redux comes into picture when the app gets large and complex. In such apps, simple data management as parent-child becomes difficult using &lt;/strong&gt;&lt;code class="markup--code markup--blockquote-code"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;props&lt;/em&gt;&lt;/strong&gt;&lt;/code&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;. There are multiple components trying to communicate with multiple other components. In such cases, Redux comes in handy.&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Redux can be broken down into few sections while building the application which is listed below.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Actions: “&lt;/strong&gt;are payloads of information that send data from your application to your store. They are the &lt;em class="markup--em markup--p-em"&gt;only&lt;/em&gt; source of information for the store.” this means if any state change necessary the change required will be dispatched through the actions.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Reducers: “&lt;/strong&gt;Actions&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;describe the fact that &lt;em class="markup--em markup--p-em"&gt;something happened&lt;/em&gt;, but don’t specify how the application’s state changes in response. This is the job of reducers.” when an action is dispatched for state change its the reducers duty to make the necessary changes to the state and return the new state of the application.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Store: &lt;/strong&gt;with help of reducers a store can be created which holds the entire state of the application it is recommended to use a single store for the entire application than having multiple stores which will violate the use of redux which only has a single store.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Components (UI): &lt;/strong&gt;This&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;is where the UI of the application is kept.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Middlewares&lt;/strong&gt;: Redux allows us to put a middleware that sits between an action being dispatched and the &lt;strong class="markup--strong markup--p-strong"&gt;action&lt;/strong&gt; that reaches to the &lt;strong class="markup--strong markup--p-strong"&gt;reducers&lt;/strong&gt;. Two very popular middleware libraries that will allow for side effects and asynchronous activities are &lt;a href="https://github.com/reduxjs/redux-thunk" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Redux Thunk&lt;/a&gt; and &lt;a href="https://github.com/redux-saga/redux-saga" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Redux Saga&lt;/a&gt;. We’ll learn more about thunk here.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Redux Thunk&lt;/strong&gt; is the middleware that lets you call the action creators that return a function instead of the action object. That function then receives the store’s dispatch method, which is then used to dispatch the regular synchronous actions inside a body of the function once the asynchronous operations have completed. The &lt;strong class="markup--strong markup--p-strong"&gt;thunk&lt;/strong&gt; is a concept in programming where a function is used to delay the evaluation/calculation of an operation. I know it’s too much of jargon, so let’s see how it works in the app.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ac30qLMK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A2--d_JqkSBPUBIe_TsppPA.jpeg"&gt;&lt;br&gt;Redux workflow in a simple schematic&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Steps for Implementing R&lt;code class="markup--code markup--h3-code"&gt;edux-thunk&lt;/code&gt; in React Native app&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;We will follow these step-by-step instructions to create our React Native with Redux Thunk&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 1: Create a Basic React Native app&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 2: Running app on a device&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 3: Install the necessary packages to connect your app with redux.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 4: Create the necessary folders inside Root.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 5: Create Actions.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 6:- Create rootReducer and postReducer.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 6: Create a Redux Store.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 7: Pass the Store to the React Native app.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 8: Connect React Native app to Redux store.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 9: Test your app&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 10: What is the basic difference between redux-thunk and redux-saga?&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;So let’s dive right in!&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ruG-Ui9w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AHfUjPCVB8Eer3q22lcuoew.gif"&gt;&lt;br&gt;Ouch! Let’s ….. not dive&lt;h3 class="graf graf--h3 graf-after--figure"&gt;1. Create a basic React Native app&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;First, make sure you have all pre-requisites to create a react-native app as per the &lt;a href="https://facebook.github.io/react-native/docs/getting-started.html" class="markup--anchor markup--p-anchor" rel="noopener"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;At the time of this post, I have React-Native version 0.60&lt;/strong&gt;&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Create a blank react-native app (Replace &lt;code class="markup--code markup--p-code"&gt;myApp&lt;/code&gt; with your own name)&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;$ react-native init myApp&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;This will create a basic React-native app which you can run in a device or simulator. (either Android or iOS)&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 2: Running app on device&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;To run the iOS app, you should specify simulator&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;react-native run-ios --simulator=”iPhone X”&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;To run Android app, you should start emulator first, either via Android Studio or &lt;code class="markup--code markup--p-code"&gt;adb&lt;/code&gt; , then call&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;react-native run-android&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;You’ll see the default start screen&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--UIavk9-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2ATnZfGsKdsWGBUac-0YutpA.jpeg"&gt;&lt;br&gt;Default start screen for React Native app&lt;h3 class="graf graf--h3 graf-after--figure"&gt;&lt;strong class="markup--strong markup--h3-strong"&gt;Step 3: Install the necessary packages to connect your app with redux.&lt;/strong&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;npm&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;npm install redux react-redux redux-thunk&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;yarn&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;yarn add redux react-redux redux-thunk&lt;/pre&gt;
&lt;blockquote class="graf graf--blockquote graf-after--pre"&gt;
&lt;a href="https://github.com/reduxjs/react-redux" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;React Redux&lt;/a&gt; is the official &lt;a href="https://reactjs.org/" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;React&lt;/a&gt; binding for &lt;a href="https://redux.js.org/" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;Redux&lt;/a&gt;. It lets your React components read data from a Redux store, and dispatch actions to the store to update data.&lt;/blockquote&gt;
&lt;blockquote class="graf graf--blockquote graf-after--blockquote"&gt;As of React Native 0.18, React Redux 5.x should work with React Native. If you have any issues with React Redux 5.x on React Native, run &lt;code class="markup--code markup--blockquote-code"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;npm ls react&lt;/em&gt;&lt;/code&gt; and make sure you don’t have a duplicate React installation in your &lt;code class="markup--code markup--blockquote-code"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;node_modules&lt;/em&gt;&lt;/code&gt;. We recommend that you use &lt;code class="markup--code markup--blockquote-code"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;&lt;a href="mailto:npm@3.x"&gt;npm@3.x&lt;/a&gt;&lt;/em&gt;&lt;/code&gt;which is better at avoiding these kinds of issues.&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;The React Redux docs are now published at &lt;a href="https://react-redux.js.org/" class="markup--anchor markup--p-anchor" rel="nofollow noopener"&gt;&lt;/a&gt;&lt;a href="https://react-redux.js.org"&gt;https://react-redux.js.org&lt;/a&gt; .&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;If you want to know how it works, check out &lt;a href="https://www.youtube.com/watch?v=VJ38wSFbM3A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;this link&lt;/a&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 5: Create the necessary folders inside Root&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Let’s keep this image in mind to help us understand which parts of Redux are implemented at what step.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--pjNmLIjc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AQ3QdBDZL4cBrR5GXT6J5jA.jpeg"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;To work with redux you can follow this folder structure for better code quality&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Create the following folders.&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;actions&lt;/strong&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;constants&lt;/strong&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;reducers&lt;/strong&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;components&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;Step 6: Create Constants and Actions&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;6.1&lt;/strong&gt; Inside the &lt;code class="markup--code markup--p-code"&gt;constants&lt;/code&gt; folder, create one file called &lt;strong class="markup--strong markup--p-strong"&gt;index.js. &lt;/strong&gt;Add the following line inside &lt;strong class="markup--strong markup--p-strong"&gt;index.js.&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;const GET_PAGE_LIST = 'GET_PAGE_LIST';&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;6.2&lt;/strong&gt; Inside the &lt;strong class="markup--strong markup--p-strong"&gt;actions &lt;/strong&gt;folder, create one file called &lt;strong class="markup--strong markup--p-strong"&gt;pageList.js. &lt;/strong&gt;Add the following code inside &lt;strong class="markup--strong markup--p-strong"&gt;pageList.js.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;Actions&lt;/code&gt; are JavaScript objects that represent payloads of information that send data from your application to your &lt;code class="markup--code markup--p-code"&gt;Redux&lt;/code&gt; store.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Actions have a type and an optional payload. In our case, the type will be &lt;code class="markup--code markup--p-code"&gt;GET_PAGE_LIST&lt;/code&gt; and the payload &lt;code class="markup--code markup--p-code"&gt;pageList&lt;/code&gt; which we are assigning into our &lt;code class="markup--code markup--p-code"&gt;pageList&lt;/code&gt; variable in store.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import { GET_PAGE_LIST } from '../constants';&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;export function setPageList(pageList) {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;return {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;type: GET_PAGE_LIST,&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;payload: pageList,&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;};&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;}&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;export function getPageList() {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;return async (dispatch) =&amp;gt; {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;try {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;const apiReq = await fetch('&lt;a href="http://dummy.restapiexample.com/api/v1/employees"&gt;http://dummy.restapiexample.com/api/v1/employees&lt;/a&gt;', {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;method: 'GET'&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;});&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;console.log(apiReq);&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;await dispatch(setPageList(apiReq));&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;return apiReq || [];&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;} catch (error) {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;console.error(error);&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;}&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;};&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;So, here we have defined an action that calls the API and gets a response from the server. Remember, the reducer is a pure function, and we do not want any asynchronous call inside reducer, all the asynchronous actions are called here inside actions.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;But, we need to connect this action to our &lt;code class="markup--code markup--p-code"&gt;App.js&lt;/code&gt; component somehow. Otherwise, we cannot add the data into the Redux store. Also, we need to first create a store. But before that, we also need to create a reducer function. So, first, create a reducer → then create a store and → then connect the React Native application to the &lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt; store.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--l8bpGuNo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AAu_jHh1Ytm-WazqHqB1J-g.jpeg"&gt;&lt;br&gt;Actions created …&lt;h3 class="graf graf--h3 graf-after--figure"&gt;&lt;strong class="markup--strong markup--h3-strong"&gt;Step 6:- Create rootReducer and postReducer.&lt;/strong&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now, inside the &lt;strong class="markup--strong markup--p-strong"&gt;reducers folder, &lt;/strong&gt;create one file called &lt;strong class="markup--strong markup--p-strong"&gt;pageList.js.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Write the following code inside the &lt;strong class="markup--strong markup--p-strong"&gt;pageListReducer.js&lt;/strong&gt;.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import { GET_PAGE_LIST } from '../constants';&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;const initialState = {&lt;br&gt;pageList: []&lt;br&gt;};&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;const &lt;strong class="markup--strong markup--pre-strong"&gt;pageListReducer &lt;/strong&gt;= (state = initialState, action) =&amp;gt; {&lt;br&gt;switch(action.type) {&lt;br&gt;case GET_PAGE_LIST:&lt;br&gt;return {&lt;br&gt;...state,&lt;br&gt;pageList: []&lt;br&gt;};&lt;br&gt;default:&lt;br&gt;return state;&lt;br&gt;}&lt;br&gt;}&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;export default &lt;strong class="markup--strong markup--pre-strong"&gt;pageListReducer&lt;/strong&gt;;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;So, here, we have defined the function called &lt;strong class="markup--strong markup--p-strong"&gt;pageListReducer &lt;/strong&gt;that accepts the two arguments.&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;state&lt;/strong&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;action&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;The first time, it will take the &lt;strong class="markup--strong markup--p-strong"&gt;initial state&lt;/strong&gt; of our application, and then we pass whatever argument, it takes that argument and operates based on the case execution. The second argument is &lt;strong class="markup--strong markup--p-strong"&gt;action, &lt;/strong&gt;which consists of &lt;strong class="markup--strong markup--p-strong"&gt;type &lt;/strong&gt;and &lt;strong class="markup--strong markup--p-strong"&gt;payload. &lt;/strong&gt;The &lt;strong class="markup--strong markup--p-strong"&gt;payload&lt;/strong&gt; is the count value, which assigned to count variable in store.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Remember here — we have returned a new state and not existing state. So we have modified the state in a pure manner.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--fnGQPCSb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2ALm-NV5s_pxehZXR58XOM9w.jpeg"&gt;&lt;br&gt;Actions and reducer created&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 7:-Create a Redux Store.&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Inside the root folder, create one folder called &lt;strong class="markup--strong markup--p-strong"&gt;store &lt;/strong&gt;and inside this folder add one file called &lt;code class="markup--code markup--p-code"&gt;configureStore.js&lt;/code&gt; add the following code.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import { createStore, combineReducers } from 'redux';&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;import pageReducer from '../reducers/pageReducer';&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;import { applyMiddleware } from 'redux';&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;import thunk from 'redux-thunk';&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;const rootReducer = combineReducers(&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;{ pageList: pageReducer }&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;);&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;const configureStore = () =&amp;gt; {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;return createStore(rootReducer, applyMiddleware(thunk));&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;}&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;export default configureStore;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Here, we have created the redux store and passed the reducer to that store. This store will ideally contain all the data that handles the app state.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The &lt;strong class="markup--strong markup--p-strong"&gt;combineReducer &lt;/strong&gt;function combines all the different reducers into one and forms the global state. So this is the global state of our whole application.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--GWTCwzuw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A5T_3GIKODoO03mrqakOULw.jpeg"&gt;&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 8: Pass the Store to the React Native app.&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Inside the root folder, you will find one file called &lt;strong class="markup--strong markup--p-strong"&gt;index.js &lt;/strong&gt;and inside that file add the following code.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
Index.js
&lt;p class="graf graf--p graf-after--figure"&gt;It is almost the same as React web application, in which we pass the Provider as a root element and pass the store and then via react-redux’s &lt;strong class="markup--strong markup--p-strong"&gt;connect&lt;/strong&gt;() function, we can &lt;strong class="markup--strong markup--p-strong"&gt;connect&lt;/strong&gt; the any react component to &lt;strong class="markup--strong markup--p-strong"&gt;redux&lt;/strong&gt; store.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--IBn9JRd8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A6kh_Lwo9EKVfsaZKtw3oTw.jpeg"&gt;&lt;br&gt;Store connected to the app&lt;h3 class="graf graf--h3 graf-after--figure"&gt;&lt;strong class="markup--strong markup--h3-strong"&gt;Step 8: Connect React Native app to Redux store.&lt;/strong&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Finally, we connect our &lt;strong class="markup--strong markup--p-strong"&gt;App.js &lt;/strong&gt;component to the &lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt; store. For that, we need the &lt;strong class="markup--strong markup--p-strong"&gt;connect() &lt;/strong&gt;function from the&lt;strong class="markup--strong markup--p-strong"&gt; react-redux&lt;/strong&gt; library.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Connect&lt;/strong&gt; which needs to be imported from &lt;em class="markup--em markup--p-em"&gt;react-redux &lt;/em&gt;and with the help of connect the properties will be mapped to the UI component.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;mapStateToProps &lt;/strong&gt;will contain all the state properties which will be available to the components of the app whatever properties that need to be accessed from the UI components need to be written into the &lt;strong class="markup--strong markup--p-strong"&gt;mapStateToProps &lt;/strong&gt;helper function.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;mapDispatchToProps &lt;/strong&gt;will contain all the necessary functions wrapped with action creators which will be mapped to the props of the app and can be called directly. The directory containing the below file is &lt;code class="markup--code markup--p-code"&gt;./actions/pageList.js&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here, when we click on the get employee button, we get the Employees value from props and change it and then send it to the action with that value. Now that action returned the object with the action type and payload and based on the type the reducer will be executed and add that values inside the store.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Now, if the store’s values are changed, then we need to update the UI based on the new values. That is why &lt;strong class="markup--strong markup--p-strong"&gt;the mapStateToProps &lt;/strong&gt;function is created. So, when the store’s count get the new value, render function executed again and update the UI.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 10: Test your app:&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Once you run the application the below UI will be rendered.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--uCjgJPKV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A7OV5yCea4w2qv9xDT6Cb-g.jpeg"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;Once you click on any of the get employe buttons it will correctly fetch data from a server and render it on UI. Although, what we just did is nothing fancy for an app, remember everything is going through the whole &lt;strong class="markup--strong markup--p-strong"&gt;“action-reducer-store-state”&lt;/strong&gt; flow. This flow can handle large and complex apps, so you don’t get stuck in&lt;strong class="markup--strong markup--p-strong"&gt; “props” &lt;/strong&gt;loops.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--JVf1tRzo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A3FxIFMjmE0Bj2KyWxtp2BA.jpeg"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;(If you are from an &lt;strong class="markup--strong markup--p-strong"&gt;Angular&lt;/strong&gt; background, for ease of understanding, you can understand &lt;code class="markup--code markup--p-code"&gt;actions&lt;/code&gt; as something similar to methods in &lt;code class="markup--code markup--p-code"&gt;services&lt;/code&gt; which we can call from any component or page. &lt;code class="markup--code markup--p-code"&gt;Reducers&lt;/code&gt; are also similar functions, but they change the central store of the app. &lt;code class="markup--code markup--p-code"&gt;Store&lt;/code&gt; can be assumed as something similar to a &lt;code class="markup--code markup--p-code"&gt;$rootscope &lt;/code&gt;object which stores all the data at one place, and can be accessed from any page. Don’t draw a direct comparison between these things, this is just to help you understand the concept in an easier way.)&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Hope this blog helps you to implement redux with middleware (thunk) in react native apps.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;&lt;strong class="markup--strong markup--h3-strong"&gt;Step 10: What is the basic difference between redux-thunk and redux-saga?&lt;/strong&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In terms of implementation, Redux-Thunk and Redux-Saga couldn’t possibly be more different. However, in terms of what you can do with them… well, they’re actually very very similar. But not the same. Redux-Thunk and Redux-Saga differ in a few important ways.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;But, first, let’s cover some background.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Redux-thunk and Redux-saga are both &lt;a href="https://redux.js.org/advanced/middleware" class="markup--anchor markup--p-anchor" rel="noopener"&gt;middleware&lt;/a&gt; libraries for Redux. Redux middleware is code that intercepts actions coming into the store via the &lt;code class="markup--code markup--p-code"&gt;dispatch()&lt;/code&gt; method.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;An action can be literally anything.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;But if you’re following best practices, an action is a plain javascript object with a &lt;code class="markup--code markup--p-code"&gt;type&lt;/code&gt; field, and optional &lt;code class="markup--code markup--p-code"&gt;payload&lt;/code&gt;, &lt;code class="markup--code markup--p-code"&gt;meta&lt;/code&gt;, and &lt;code class="markup--code markup--p-code"&gt;error&lt;/code&gt; fields. E.g.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;const loginRequest = {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;type: 'LOGIN_REQUEST',&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;payload: {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;name: 'admin',&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;password: '123',&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;},&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;};&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;(by the way, this structure is called &lt;a href="https://github.com/acdlite/flux-standard-action#actions" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Flux Standard Action&lt;/a&gt;)&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;This is what the type signature looks like in TypeScript&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;type Action = {    &lt;br&gt;     type: string;    &lt;br&gt;     payload?: any;    &lt;br&gt;     meta?: any;    &lt;br&gt;     error?: boolean;&lt;br&gt;};&lt;/code&gt;&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;Redux-Thunk&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In addition to dispatching standard actions, Redux-Thunk middleware allows you to dispatch special functions, called &lt;a href="https://en.wikipedia.org/wiki/Thunk" class="markup--anchor markup--p-anchor" rel="noopener"&gt;thunks&lt;/a&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Thunks (in Redux) generally have the following structure:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;export const thunkName =   parameters =&amp;gt;   &lt;br&gt;     (dispatch, getState) =&amp;gt; {         &lt;br&gt;   // Your application logic goes here      &lt;br&gt; };&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;That is, a thunk is a function that (optionally) takes some parameters and returns another function. The inner function takes a &lt;code class="markup--code markup--p-code"&gt;dispatch&lt;/code&gt; function and a &lt;code class="markup--code markup--p-code"&gt;getState&lt;/code&gt; function -- both of which will be supplied by the Redux-Thunk middleware.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here we have an example thunk that attempts to call a login API with a username and password. The thunk first dispatches an action indicating that the request is starting. It then makes the call. Finally, it dispatches either a success action or a failure action depending on whether or not the API call succeeded.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import * as api from 'api';&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;import { loginRequest, loginSuccess, loginFailure } from './loginActions';&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;export const loginThunk =&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;(name: string, password: string) =&amp;gt;&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;(dispatch: Function) =&amp;gt; {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;   dispatch(loginRequest());&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;   try {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;      api.login(name, password);&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;   }catch (err) {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;     dispatch(loginFailure(err));&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;     return;&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;   }&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;   dispatch(loginSuccess());&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;};&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;When you dispatch your thunk, e.g. &lt;code class="markup--code markup--p-code"&gt;dispatch(loginThunk('admin', 'secret'));&lt;/code&gt; Redux-Thunk calls your inner function, which is essentially:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;(dispatch: Function) =&amp;gt; {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;  dispatch(loginRequest());&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;  try {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;     api.login('admin', 'secret'); // values from closure&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;  }catch (err) {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;    dispatch(loginFailure(err));&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;    return;&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;  }&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;  dispatch(loginSuccess());&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;};&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now that we’ve covered the basics of Redux-thunk, let’s look at Redux-Saga&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Redux-Saga&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Redux-Saga middleware allows you to express complex application logic as &lt;a href="https://en.wikipedia.org/wiki/Pure_function" class="markup--anchor markup--p-anchor" rel="noopener"&gt;pure functions&lt;/a&gt; called sagas. Pure functions are desirable from a testing standpoint because they are predictable and repeatable, which makes them relatively easy to test.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Sagas are implemented through special functions called &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function%252A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;generator functions&lt;/a&gt;. These are a new feature of ES6 JavaScript. Basically, execution jumps in and out of a generator everywhere you see a &lt;code class="markup--code markup--p-code"&gt;yield&lt;/code&gt;statement. Think of a &lt;code class="markup--code markup--p-code"&gt;yield&lt;/code&gt; statement as causing the generator to pause and return the yielded value. Later on, the caller can resume the generator at the statement following the &lt;code class="markup--code markup--p-code"&gt;yield&lt;/code&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;A generator function is one defined like this. Notice the asterisk after the function keyword.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;function* mySaga() {    // ...}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;We can rewrite the login functionality from before as a saga. It looks like this:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import * as api from 'api';&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;import { LoginRequestAction, loginSuccess, loginFailure } from './loginActions';&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;function* loginSaga() {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;const action: LoginRequestAction = yield take('LOGIN_REQUEST');&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;const { name, password } = action.payload;&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;try {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;yield call(api.login, name, password);&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;}&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;catch (err) {&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;yield put(loginFailure(err));&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;return;&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;}&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;yield put(loginSuccess());&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Once the login saga is registered with Redux-Saga, it will begin executing immediately. But then the &lt;code class="markup--code markup--p-code"&gt;yield take&lt;/code&gt; on the the first line will pause the saga until an action with type &lt;code class="markup--code markup--p-code"&gt;'LOGIN_REQUEST'&lt;/code&gt; is dispatched to the store. Once that happens, execution will continue.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;The Biggest Difference&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;You might think the biggest difference is in the syntax. Although it’s true that writing and reasoning about thunks and sagas are quite different, there’s something bigger.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Thunks can never act in response to an action.&lt;/strong&gt; Redux-Saga, on the other hand, subscribes to the store and can trigger a saga to run or continue when a certain action is dispatched.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this post, you learned how to implement Redux with middleware(redux-thunk) in your React Native app. You learnt what are reducers, actions, and store, how the flow of data is managed in a Redux based app.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--VzF5UucG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AceLX14cSsAZ-M7c2GHdlSA.gif"&gt;&lt;br&gt;Now, chill&lt;p class="graf graf--p graf-after--figure"&gt;And that’s it! The application now uses Redux and Redux Thunk to fetch and display the data!&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;That wasn’t too difficult, was it?&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;And you’re now a Redux master :D&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Stay tuned for more Ionic and React Native blogs!&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Happy Coding.🤓👍🏼&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;em class="markup--em markup--blockquote-em"&gt;Complete source code of this tutorial is available in the &lt;/em&gt;&lt;a href="https://github.com/enappd/react-native-redux-thunk.git" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;React-native-redux-thunk-example&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learnt about setting up Redux with middleware(redux-thunk) in React Native apps, here are some other topics you can look into&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Firebase — &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Integrate Firebase&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-analytics-in-react-native-app/101" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Analytics&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Push notifications&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Firebase CRUD&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To in React Native — &lt;a href="https://enappd.com/blog/geolocation-geocoding-react-native-apps/84" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/pick-images-from-camera-gallery-in-react-native-app/78" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Redux implementation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-make-api-calls-in-react-native-apps/125" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Make API calls&lt;/a&gt; | &lt;a href="https://enappd.com/blog/navigations-in-react-native-app/124" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Navigation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-translate-in-react-native-app-globalization-internationalization-and-text-to-speech/120" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Translation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-qr-code-scanning-using-react-native-camera/117" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Barcode &amp;amp; QR code scan&lt;/a&gt; | &lt;a href="https://enappd.com/blog/send-read-and-delete-sms-in-react-native/107" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Send &amp;amp; Read SMS&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-vision-with-react-native/96" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Vision&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Payments — &lt;a href="https://enappd.com/blog/implement-apple-pay-in-react-native-apps/93" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/stripe-integration-in-react-native-apps-using-firebase/108" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe payments&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Authentication — &lt;a href="https://enappd.com/blog/google-login-in-react-native-android-apps-with-firebase/90" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Google Login&lt;/a&gt;| &lt;a href="https://enappd.com/blog/facebook-login-in-react-native-apps/89" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Facebook login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Phone Auth&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-react-native-apps-using-firebase/95" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/anonymous-login-in-react-native-apps-with-firebase/129" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous Login&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-make-stories-ui-like-instagram-and-whatsapp-in-react-native/123" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Instagram / Whatsapp Story Feature in React Native&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;React Native life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Implement Redux&lt;/a&gt; | &lt;a href="https://enappd.com/blog/async-actions-with-redux-thunk-middleware-in-react-native-apps-1/100" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Async actions with Redux&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/guide-on-react-native-full-app/53" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next React Native app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/react-native-full-app/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CF89hkbC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AsWyEeAfCMk7ULOkLUCdSug.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>redux</category>
      <category>middleware</category>
    </item>
    <item>
      <title>How to implement Redux in React Native apps</title>
      <dc:creator>Umang Darji</dc:creator>
      <pubDate>Fri, 27 Mar 2020 04:19:43 +0000</pubDate>
      <link>https://forem.com/enappd/how-to-implement-redux-in-react-native-apps-41ol</link>
      <guid>https://forem.com/enappd/how-to-implement-redux-in-react-native-apps-41ol</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;This post will assist any developer to learn on how &lt;a href="https://redux.js.org/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Redux&lt;/a&gt; works with react native by creating a simple application with basic data flow.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;em class="markup--em markup--blockquote-em"&gt;Complete source code of this tutorial is available in the &lt;/em&gt;&lt;a href="https://github.com/enappd/react-native-redux.git" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;React-native-redux-example&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;What Is React Native?&lt;/h3&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--t96EJSNq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AhVemiPgn143L4vIdAevNvw.jpeg"&gt;&lt;br&gt;React Native logo&lt;p class="graf graf--p graf-after--figure is-selected"&gt;React Native is a JavaScript framework for writing real, natively rendering mobile applications for iOS and Android. It’s based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. In other words: web developers can now write mobile applications that look and feel truly “native,” all from the comfort of a JavaScript library that we already know and love. Plus, because most of the code you write can be shared between platforms, React Native makes it easy to simultaneously develop for both Android and iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Similar to React for the Web, React Native applications are written using a mixture of JavaScript and XML markup, known as JSX. Then, under the hood, the React Native “bridge” invokes the native rendering APIs in Objective-C (for iOS) or Java (for Android). Thus, your application will render using real mobile UI components, not webviews, and will look and feel like any other mobile application. React Native also exposes JavaScript interfaces for platform APIs, so your React Native apps can access platform features like the phone camera, or the user’s location.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native currently supports both iOS and Android and has the potential to expand to future platforms as well. In this blog, we’ll cover both iOS and Android. The vast majority of the code we write will be cross-platform. And yes: you can really use React Native to build production-ready mobile applications! Some example: &lt;a href="http://bit.ly/1YipO7A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Facebook&lt;/a&gt;, &lt;a href="http://bit.ly/1PPEiZH" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Palantir&lt;/a&gt;, and &lt;a href="http://bit.ly/1PPEjNg" class="markup--anchor markup--p-anchor" rel="noopener"&gt;TaskRabbit&lt;/a&gt; are already using it in production for user-facing applications.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is Redux?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;a href="https://redux.js.org/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt;&lt;/a&gt; is a standalone state management library, which can be used with any library or framework. If your background is &lt;strong class="markup--strong markup--p-strong"&gt;React developer&lt;/strong&gt;, then you have used the &lt;strong class="markup--strong markup--p-strong"&gt;Redux library with React&lt;/strong&gt;. The primary use of &lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt; is that we can use one application state as a global state and interact with the state from any react component is very easy whether they are siblings or parent-child.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--v_kUprvc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AkwMieaTmikxMDhZfI-yeaw.png"&gt;&lt;br&gt;Redux Logo&lt;blockquote class="graf graf--blockquote graf-after--figure"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Basic usage of Redux comes into picture when the app gets large and complex. In such apps, simple data management as parent-child becomes difficult using &lt;/strong&gt;&lt;code class="markup--code markup--blockquote-code"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;props&lt;/strong&gt;&lt;/code&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;. There are multiple components trying to communicate with multiple other components. In such cases, Redux comes in handy.&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Redux can be broken down into few sections while building the application which is listed below.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Actions: “&lt;/strong&gt;are payloads of information that send data from your application to your store. They are the &lt;em class="markup--em markup--p-em"&gt;only&lt;/em&gt; source of information for the store.” this means if any state change necessary the change required will be dispatched through the actions.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Reducers: “&lt;/strong&gt;Actions&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;describe the fact that &lt;em class="markup--em markup--p-em"&gt;something happened&lt;/em&gt;, but don’t specify how the application’s state changes in response. This is the job of reducers.” when an action is dispatched for state change its the reducers duty to make the necessary changes to the state and return the new state of the application.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Store: &lt;/strong&gt;with help of reducers a store can be created which holds the entire state of the application it is recommended to use a single store for the entire application than having multiple stores which will violate the use of redux which only has a single store.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Components (UI): &lt;/strong&gt;This&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;is where the UI of the application is kept.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Middlewares&lt;/strong&gt;: middleware can be used for a variety of things, including asynchronous API calls. Middleware sounds much more complicated than it really is. The only way to really understand middleware is to see how the existing middleware works and try to write your own.we will cover middleware in the next blog.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ac30qLMK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A2--d_JqkSBPUBIe_TsppPA.jpeg"&gt;&lt;br&gt;Redux workflow in simple schematic&lt;p class="graf graf--p graf-after--figure"&gt;Without further explanation, let’s get into the coding aspects.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Steps for Implementing Redux in React Native app&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;We will follow these step-by-step instructions to create our React Native with Redux&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 1: Create a Basic React Native app&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 2: Running app on device&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;‌Step 3: Add simple counter into the App.js.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 4: Install the necessary packages to connect your app with redux.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 5: Create the necessary folders inside Root.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 6: Create Actions and Reducer function.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 7: Create a Redux Store.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 8: Pass the Store to the React Native app.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 9: Connect React Native app to Redux store.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 10: Test your app&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;So let’s dive right in!&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ruG-Ui9w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AHfUjPCVB8Eer3q22lcuoew.gif"&gt;&lt;br&gt;Ouch! Let’s ….. not dive&lt;h3 class="graf graf--h3 graf-after--figure"&gt;1. Create a basic React Native app&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;First, make sure you have all pre-requisites to create a react-native app as per the &lt;a href="https://facebook.github.io/react-native/docs/getting-started.html" class="markup--anchor markup--p-anchor" rel="noopener"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;At the time of this post, I have React-Native version 0.60&lt;/strong&gt;&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Create a blank react-native app (Replace &lt;code class="markup--code markup--p-code"&gt;myApp&lt;/code&gt; with your own name)&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;$ react-native init myApp&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;This will create a basic React-native app which you can run in a device or simulator. (either Android or iOS)&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 2: Running app on device&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;To run the iOS app, you should specify simulator&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;react-native run-ios --simulator=”iPhone X”&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;To run Android app, you should start emulator first, either via Android Studio or &lt;code class="markup--code markup--p-code"&gt;adb&lt;/code&gt; , then call&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;react-native run-android&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;You’ll see the default start screen&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--UIavk9-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2ATnZfGsKdsWGBUac-0YutpA.jpeg"&gt;&lt;br&gt;Default start screen for React Native app&lt;h3 class="graf graf--h3 graf-after--figure"&gt;‌Step 3: Add simple counter into the App.js.&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now we’ll change&lt;code class="markup--code markup--p-code"&gt;App.js&lt;/code&gt; to contain the UI required to render on the application with all the styling’s as shown below. The UI will contain two button’s and a text to show the count. All the class actions will be accessed using the &lt;code class="markup--code markup--p-code"&gt;this&lt;/code&gt; variable and all the state variable will be accessed using &lt;code class="markup--code markup--p-code"&gt;this.state&lt;/code&gt; which contain the current state of the app. Within the button &lt;code class="markup--code markup--p-code"&gt;onPress&lt;/code&gt; field, the actions will be called which are defined on the class in &lt;code class="markup--code markup--p-code"&gt;App.js&lt;/code&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;So after adding this counter your &lt;code class="markup--code markup--p-code"&gt;App.js&lt;/code&gt; looks something like this.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--z6HASYk1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AC5riZSuBtgeRRAs5T71hVA.jpeg"&gt;&lt;h3 class="graf graf--h3 graf-after--figure"&gt;&lt;strong class="markup--strong markup--h3-strong"&gt;Step 4: Install the necessary packages to connect your app with redux&lt;/strong&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In order to get redux to work with react-native few packages need to be installed as shown below&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;npm&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;npm install react-redux&lt;br&gt;npm install redux&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;yarn&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;yarn add react-redux&lt;br&gt;yarn add redux&lt;/pre&gt;
&lt;blockquote class="graf graf--blockquote graf-after--pre"&gt;
&lt;a href="https://github.com/reduxjs/react-redux" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;React Redux&lt;/a&gt; is the official &lt;a href="https://reactjs.org/" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;React&lt;/a&gt; binding for &lt;a href="https://redux.js.org/" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;Redux&lt;/a&gt;. It lets your React components read data from a Redux store, and dispatch actions to the store to update data.&lt;/blockquote&gt;
&lt;blockquote class="graf graf--blockquote graf-after--blockquote"&gt;As of React Native 0.18, React Redux 5.x should work with React Native. If you have any issues with React Redux 5.x on React Native, run &lt;code class="markup--code markup--blockquote-code"&gt;npm ls react&lt;/code&gt; and make sure you don’t have a duplicate React installation in your &lt;code class="markup--code markup--blockquote-code"&gt;node_modules&lt;/code&gt;. We recommend that you use &lt;code class="markup--code markup--blockquote-code"&gt;&lt;a href="mailto:npm@3.x"&gt;npm@3.x&lt;/a&gt;&lt;/code&gt;which is better at avoiding these kinds of issues.&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;The React Redux docs are now published at &lt;a href="https://react-redux.js.org/" class="markup--anchor markup--p-anchor" rel="nofollow noopener"&gt;&lt;/a&gt;&lt;a href="https://react-redux.js.org"&gt;https://react-redux.js.org&lt;/a&gt; .&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;If you want to know how it works, check out &lt;a href="https://www.youtube.com/watch?v=VJ38wSFbM3A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;this link&lt;/a&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;&lt;strong class="markup--strong markup--h3-strong"&gt;Step 5: Create the necessary folders inside Root&lt;/strong&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Let’s keep this image in mind to help us understand which parts of Redux are implemented at what step.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--pjNmLIjc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AQ3QdBDZL4cBrR5GXT6J5jA.jpeg"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;To work with redux you can follow this folder structure for better code quality&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Create the following folders.&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;actions&lt;/strong&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;constants&lt;/strong&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;reducers&lt;/strong&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;components&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;&lt;strong class="markup--strong markup--h3-strong"&gt;Step 6: Create Constants, Actions, and Reducer function&lt;/strong&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;6.1&lt;/strong&gt; Inside the &lt;code class="markup--code markup--p-code"&gt;constants&lt;/code&gt; folder, create one file called &lt;strong class="markup--strong markup--p-strong"&gt;index.js. &lt;/strong&gt;Add the following line inside &lt;strong class="markup--strong markup--p-strong"&gt;index.js.&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;export const COUNTER_CHANGE = 'COUNTER_CHANGE'&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;6.2&lt;/strong&gt; Inside the &lt;strong class="markup--strong markup--p-strong"&gt;actions &lt;/strong&gt;folder, create one file called &lt;strong class="markup--strong markup--p-strong"&gt;counts.js. &lt;/strong&gt;Add the following code inside &lt;strong class="markup--strong markup--p-strong"&gt;counts.js.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;Actions&lt;/code&gt; are JavaScript objects that represent payloads of information that send data from your application to your &lt;code class="markup--code markup--p-code"&gt;Redux&lt;/code&gt; store.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Actions have a type and an optional payload. In our case, the type will be &lt;code class="markup--code markup--p-code"&gt;COUNTER_CHANGE&lt;/code&gt;, and the payload &lt;code class="markup--code markup--p-code"&gt;count&lt;/code&gt; which we are assigning into our &lt;code class="markup--code markup--p-code"&gt;count&lt;/code&gt; variable in store.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import { COUNTER_CHANGE } from '../constants';&lt;br&gt;export function changeCount(count) {&lt;br&gt;  return {&lt;br&gt;    type: COUNTER_CHANGE,&lt;br&gt;    payload: count&lt;br&gt;  }&lt;br&gt;}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;The &lt;strong class="markup--strong markup--p-strong"&gt;changeCount() &lt;/strong&gt;function returns an action. Now based on that action, reducers function’s case is executed.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;But, we need to connect this action to our &lt;code class="markup--code markup--p-code"&gt;App.js&lt;/code&gt; component somehow. Otherwise, we cannot add the data into the Redux store. Also, we need to first create a store. But before that, we also need to create a reducer function. So, first, create a reducer → then create a store and → then connect the React Native application to the &lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt; store.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--l8bpGuNo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AAu_jHh1Ytm-WazqHqB1J-g.jpeg"&gt;&lt;br&gt;Actions created …&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;6.3&lt;/strong&gt; Inside &lt;strong class="markup--strong markup--p-strong"&gt;reducers &lt;/strong&gt;function, create one file called &lt;strong class="markup--strong markup--p-strong"&gt;countReducer.js. &lt;/strong&gt;Add the following code inside it.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;A &lt;code class="markup--code markup--p-code"&gt;reducer&lt;/code&gt; is a pure function that takes the previous &lt;code class="markup--code markup--p-code"&gt;state&lt;/code&gt; and an &lt;code class="markup--code markup--p-code"&gt;action&lt;/code&gt; as arguments and returns a new state. The reducer is instrumental in keeping the current &lt;code class="markup--code markup--p-code"&gt;state&lt;/code&gt; of &lt;code class="markup--code markup--p-code"&gt;count&lt;/code&gt; updated throughout our app as it changes.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import { COUNTER_CHANGE } from '../constants';&lt;br&gt;const initialState = {&lt;br&gt;  count: 0&lt;br&gt;};&lt;br&gt;const countReducer = (state = initialState, action) =&amp;gt; {&lt;br&gt;  switch(action.type) {&lt;br&gt;    case COUNTER_CHANGE:&lt;br&gt;      return {&lt;br&gt;        ...state,&lt;br&gt;        count:action.payload&lt;br&gt;      };&lt;br&gt;    default:&lt;br&gt;      return state;&lt;br&gt;  }&lt;br&gt;}&lt;br&gt;export default countReducer;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;So, here, we have defined the function called &lt;strong class="markup--strong markup--p-strong"&gt;countReducer&lt;/strong&gt; that accepts the two arguments.&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;state&lt;/strong&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;action&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;The first time, it will take the &lt;strong class="markup--strong markup--p-strong"&gt;initial state&lt;/strong&gt; of our application, and then we pass whatever argument, it takes that argument and operates based on the case execution. The second argument is &lt;strong class="markup--strong markup--p-strong"&gt;action, &lt;/strong&gt;which consists of &lt;strong class="markup--strong markup--p-strong"&gt;type &lt;/strong&gt;and &lt;strong class="markup--strong markup--p-strong"&gt;payload. &lt;/strong&gt;The &lt;strong class="markup--strong markup--p-strong"&gt;payload&lt;/strong&gt; is the count value, which assigned to count variable in store.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Remember here — we have returned a new state and not existing state. So we have modified the state in pure manner.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--fnGQPCSb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2ALm-NV5s_pxehZXR58XOM9w.jpeg"&gt;&lt;br&gt;Actions and reducer created&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 7:-Create a Redux Store.&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Inside the root folder, create one folder called &lt;strong class="markup--strong markup--p-strong"&gt;store &lt;/strong&gt;and inside this folder add one file called &lt;code class="markup--code markup--p-code"&gt;configureStore.js&lt;/code&gt; add the following code.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import { createStore, combineReducers } from 'redux';&lt;br&gt;import countReducer from '../reducers/countReducer';&lt;br&gt;const rootReducer = combineReducers(&lt;br&gt;{ count: countReducer }&lt;br&gt;);&lt;br&gt;const configureStore = () =&amp;gt; {&lt;br&gt;return createStore(rootReducer);&lt;br&gt;}&lt;br&gt;export default configureStore;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Here, we have created the redux store and passed the reducer to that store. This store will ideally contain all the data that handles the app state.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The &lt;strong class="markup--strong markup--p-strong"&gt;combineReducer &lt;/strong&gt;function combines all the different reducers into one and forms the global state. So this is the global state of our whole application.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--GWTCwzuw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A5T_3GIKODoO03mrqakOULw.jpeg"&gt;&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 8: Pass the Store to the React Native app.&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Inside the root folder, you will find one file called &lt;strong class="markup--strong markup--p-strong"&gt;index.js &lt;/strong&gt;and inside that file add the following code.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;It is almost the same as React web application, in which we pass the Provider as a root element and pass the store and then via react-redux’s &lt;strong class="markup--strong markup--p-strong"&gt;connect&lt;/strong&gt;() function, we can &lt;strong class="markup--strong markup--p-strong"&gt;connect&lt;/strong&gt; the any react component to &lt;strong class="markup--strong markup--p-strong"&gt;redux&lt;/strong&gt; store.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--IBn9JRd8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A6kh_Lwo9EKVfsaZKtw3oTw.jpeg"&gt;&lt;br&gt;Store connected to the app&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 9: Connect React Native app to Redux store.&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Finally, we connect our &lt;strong class="markup--strong markup--p-strong"&gt;App.js &lt;/strong&gt;component to the &lt;strong class="markup--strong markup--p-strong"&gt;Redux&lt;/strong&gt; store. For that, we need the &lt;strong class="markup--strong markup--p-strong"&gt;connect() &lt;/strong&gt;function from the&lt;strong class="markup--strong markup--p-strong"&gt; react-redux&lt;/strong&gt; library.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--KcvZvEbV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2As7Zns1QN9G_w0O_rwNCNAA.jpeg"&gt;&lt;br&gt;And finally, store is now connected to UI via State&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Connect&lt;/strong&gt; which needs to be imported from &lt;em class="markup--em markup--p-em"&gt;react-redux &lt;/em&gt;and with the help of connect the properties will be mapped to the UI component.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;mapStateToProps &lt;/strong&gt;will contain all the state properties which will be available to the components of the app whatever properties that need to be accessed from the UI components need to be written into the &lt;strong class="markup--strong markup--p-strong"&gt;mapStateToProps &lt;/strong&gt;helper function.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;mapDispatchToProps &lt;/strong&gt;will contain all the necessary functions wrapped with action creators which will be mapped to the props of the app and can be called directly. The directory containing the below file is&lt;code class="markup--code markup--p-code"&gt; ./actions/counts.js&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here, when we click on the increment or decrement button, we get the count value from props and change it and then send it to the action with that value. Now that action returned the object with the action type and payload and based on the type the reducer will be executed and add that values inside the store.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Now, if the store’s values are changed, then we need to update the UI based on the new values. That is why &lt;strong class="markup--strong markup--p-strong"&gt;the mapStateToProps &lt;/strong&gt;function is created. So, when the store’s count get the new value, render function executed again and update the UI.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;&lt;strong class="markup--strong markup--h3-strong"&gt;Step 10: Test your app:&lt;/strong&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Once you run the application the below UI will be rendered.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--z6HASYk1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AC5riZSuBtgeRRAs5T71hVA.jpeg"&gt;&lt;br&gt;Basic Redux Example&lt;p class="graf graf--p graf-after--figure"&gt;Once you click on any of the buttons it will correctly increment and decrement the count. Although, what we just did is nothing fancy for an app, remember everything is going through the whole &lt;strong class="markup--strong markup--p-strong"&gt;“action-reducer-store-state”&lt;/strong&gt; flow. This flow can handle large and complex apps, so you don’t get stuck in&lt;strong class="markup--strong markup--p-strong"&gt; “props” &lt;/strong&gt;loops.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;(If you are from an &lt;strong class="markup--strong markup--p-strong"&gt;Angular&lt;/strong&gt; background, for ease of understanding, you can understand &lt;code class="markup--code markup--p-code"&gt;actions&lt;/code&gt; as something similar to methods in &lt;code class="markup--code markup--p-code"&gt;services&lt;/code&gt; which we can call from any component or page. &lt;code class="markup--code markup--p-code"&gt;Reducers&lt;/code&gt; are also similar functions, but they change the central store of the app. &lt;code class="markup--code markup--p-code"&gt;Store&lt;/code&gt; can be assumed as something similar to a &lt;code class="markup--code markup--p-code"&gt;$rootscope &lt;/code&gt;object which stores all the data at one place, and can be accessed from any page. Don’t draw a direct comparison between these things, this is just to help you understand the concept in an easier way.)&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Hope this blog helps you to implement redux with react native apps.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this post, you learned how to implement Redux in your React Native app. You learnt what are reducers, actions and store, how the flow of data is managed in a Redux based app.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--VzF5UucG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AceLX14cSsAZ-M7c2GHdlSA.gif"&gt;&lt;br&gt;Now, chill&lt;p class="graf graf--p graf-after--figure"&gt;Stay tuned for more Ionic and React Native blogs !&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Happy Coding.🤓👍🏼&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;em class="markup--em markup--blockquote-em"&gt;Complete source code of this tutorial is available in the &lt;/em&gt;&lt;a href="https://github.com/enappd/react-native-redux.git" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;React-native-redux-example&lt;/a&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;The next post will be on how to implement async actions with the help of middlewares.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learnt about setting up Redux in React Native apps, here are some other topics you can look into&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Firebase — &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Integrate Firebase&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-analytics-in-react-native-app/101" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Analytics&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Push notifications&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Firebase CRUD&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To in React Native — &lt;a href="https://enappd.com/blog/geolocation-geocoding-react-native-apps/84" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/pick-images-from-camera-gallery-in-react-native-app/78" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Redux implementation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-make-api-calls-in-react-native-apps/125" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Make API calls&lt;/a&gt; | &lt;a href="https://enappd.com/blog/navigations-in-react-native-app/124" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Navigation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-translate-in-react-native-app-globalization-internationalization-and-text-to-speech/120" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Translation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-qr-code-scanning-using-react-native-camera/117" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Barcode &amp;amp; QR code scan&lt;/a&gt; | &lt;a href="https://enappd.com/blog/send-read-and-delete-sms-in-react-native/107" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Send &amp;amp; Read SMS&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-vision-with-react-native/96" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Vision&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Payments — &lt;a href="https://enappd.com/blog/implement-apple-pay-in-react-native-apps/93" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/stripe-integration-in-react-native-apps-using-firebase/108" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe payments&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Authentication — &lt;a href="https://enappd.com/blog/google-login-in-react-native-android-apps-with-firebase/90" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Google Login&lt;/a&gt;| &lt;a href="https://enappd.com/blog/facebook-login-in-react-native-apps/89" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Facebook login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Phone Auth&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-react-native-apps-using-firebase/95" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/anonymous-login-in-react-native-apps-with-firebase/129" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous Login&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-make-stories-ui-like-instagram-and-whatsapp-in-react-native/123" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Instagram / Whatsapp Story Feature in React Native&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;React Native life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Implement Redux&lt;/a&gt; | &lt;a href="https://enappd.com/blog/async-actions-with-redux-thunk-middleware-in-react-native-apps-1/100" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Async actions with Redux&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/guide-on-react-native-full-app/53" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next React Native app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/react-native-full-app/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CF89hkbC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AsWyEeAfCMk7ULOkLUCdSug.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>redux</category>
      <category>state</category>
    </item>
    <item>
      <title>React Native V/s Ionic V/s Flutter in 2019</title>
      <dc:creator>Umang Darji</dc:creator>
      <pubDate>Fri, 27 Mar 2020 04:09:52 +0000</pubDate>
      <link>https://forem.com/enappd/react-native-v-s-ionic-v-s-flutter-in-2019-4k7e</link>
      <guid>https://forem.com/enappd/react-native-v-s-ionic-v-s-flutter-in-2019-4k7e</guid>
      <description>
&lt;h3 class="graf graf--h3 graf--leading graf--title"&gt;React Native V/s Ionic V/s Flutter in 2019&lt;/h3&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--q0ZdQgVu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2560/1%2A43Y8P1XAsfxexzbQGDN8GQ.png"&gt;&lt;span class="defaultValue"&gt;Type caption for image (optional)&lt;/span&gt;&lt;br&gt;&lt;p class="graf graf--p graf-after--figure"&gt;In this post, we’ll try to compare — Ionic, React Native and Flutter framework. All three technologies &lt;strong class="markup--strong markup--p-strong"&gt;allow you to build mobile apps for both iOS and Android. &lt;/strong&gt;All three are great frameworks because they allow developers to quickly prototype and publish apps on multiple platform with single source code.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The first great thing is — You can publish apps without the need to learn Swift, Objective-C, Java or Kotlin! Instead, you’ll use JavaScript (for React Native, and Ionic) and Dart (for Flutter). Hence you’re able to create native apps for both platforms with one language instead of two — this obviously reduces the learning effort you have to take to build your mobile app by a lot!&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Great! So how do these technologies differ, which one is the best choice for your next mobile project? Let’s take a look…&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is Ionic 4?&lt;/h3&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--gGh-lmhT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AZU1eWct801yP-QpUJOaI6Q.png"&gt;Ionic Logo&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic&lt;/strong&gt; is a complete open-source SDK for hybrid mobile app development created by &lt;a href="https://medium.com/u/a76fa51de1ba?source=post_page---------------------------" class="markup--anchor markup--p-anchor"&gt;Max Lynch&lt;/a&gt;, &lt;a href="https://medium.com/u/14b1be5c1354?source=post_page---------------------------" class="markup--anchor markup--p-anchor"&gt;Ben Sperry&lt;/a&gt; and Adam Bradley of Drifty Co. in 2013. Ionic provides tools and services for developing hybrid mobile apps using Web technologies like CSS, HTML5, and Sass. Apps can be built with these Web technologies and then distributed through native app stores to be installed on devices by leveraging Cordova.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;So, in other words — If you create Native apps in Android, you code in Java. If you create Native apps in iOS, you code in Obj-C or Swift. Both of these are powerful but complex languages. &lt;strong class="markup--strong markup--p-strong"&gt;With Cordova (and Ionic) you can write a single piece of code for your app that can run on both iOS and Android &lt;/strong&gt;(and windows!), that too with the simplicity of HTML, CSS, and JS.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What Is React Native?&lt;/h3&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--NcXOiqCj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AR85ud_A5Ag7i52oQwemI6Q.png"&gt;React native Logo&lt;p class="graf graf--p graf-after--figure"&gt;React Native is a JavaScript framework for writing real, natively rendering mobile applications for iOS and Android. It’s based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. In other words: web developers can now write mobile applications that look and feel truly “native,” all from the comfort of a JavaScript library that we already know and love. Plus, because most of the code you write can be shared between platforms, React Native makes it easy to simultaneously develop for both Android and iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Similar to React for the Web, React Native applications are written using a mixture of JavaScript and XML markup, known as JSX. Then, under the hood, the React Native “bridge” invokes the native rendering APIs in Objective-C (for iOS) or Java (for Android). Thus, your application will render using real mobile UI components, not webviews, and will look and feel like any other mobile application. React Native also exposes JavaScript interfaces for platform APIs, so your React Native apps can access platform features like the phone camera, or the user’s location.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native currently supports both iOS and Android and has the potential to expand to future platforms as well. In this blog, we’ll cover both iOS and Android. The vast majority of the code we write will be cross-platform. And yes: you can really use React Native to build production-ready mobile applications! Some example: &lt;a href="https://medium.com/r/?url=http%3A%2F%2Fbit.ly%2F1YipO7A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Facebook&lt;/a&gt;, &lt;a href="https://medium.com/r/?url=http%3A%2F%2Fbit.ly%2F1PPEiZH" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Palantir&lt;/a&gt;, and &lt;a href="https://medium.com/r/?url=http%3A%2F%2Fbit.ly%2F1PPEjNg" class="markup--anchor markup--p-anchor" rel="noopener"&gt;TaskRabbit&lt;/a&gt; are already using it in production for user-facing applications.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is Flutter?&lt;/h3&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--NflMpAog--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AgTqZ01Owzh7lMaW4vdkfSQ.png"&gt;Flutter Logo&lt;p class="graf graf--p graf-after--figure"&gt;Flutter is Google’s portable UI toolkit for crafting high-quality native experiences for mobile, web and desktop in record time. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Flutter is built with C, C++, Dart, and Skia (a 2D rendering engine). See this &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fdocs.google.com%2Fpresentation%2Fd%2F1cw7A4HbvM_Abv320rVgPVGiUP2msVs7tfGbkgdrTy0I%2Fedit%23slide%3Did.gbb3c3233b_0_162" class="markup--anchor markup--p-anchor" rel="noopener"&gt;architecture diagram&lt;/a&gt; for a better picture of the main components.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;For developers, Flutter lowers the bar to entry for building mobile apps. It speeds up the development of mobile apps and reduces the cost and complexity of app production across iOS and Android.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;For designers, Flutter helps deliver the original design vision, without loss of fidelity or compromises. It also acts as a productive prototyping tool.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What’s the point of comparing these 3 Best Tools for Modern App Development?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;When developers (or even non-developers) want to create an app for their startup or business, the first question that pops up in their mind is &lt;strong class="markup--strong markup--p-strong"&gt;Which framework is best for app development&lt;/strong&gt;. The question becomes important from cost, performance and time point-of-view.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;We’ve got your back in case you are finding the best tool to develop a new mobile app or revamp existing app. This post tries to solve all your questions regarding best cross-platform app development tools and what to choose and when.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;We also want to make one thing clear that what to choose and when always remains subjective and depends on many factors. But this post can help you decide the best framework according to your needs.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Flutter vs. React Native vs. Ionic&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Flutter is a software development kit developed by Google by using the Dart programming language. React Native is an SDK developed by Facebook, and the designing of the mobile applications take place JavaScript. Ionic follows a different approach while compared to the other two. With Ionic, you will create a real native app using web app with HTML, JSS, and CSS. The wrapped web content ensures that you can re-use or re-code the code.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Top 11 Attributes to Consider While Selecting the Platforms for Cross-platform Mobile App Development&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;To decide which one is better for Cross-Platform Mobile App Development lets first define the attributes based on which we will compare all of the above. And, these are:&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;The Language Stack&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Do not repeat yourself(DRY)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Rich pre-styled Component Library&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Performance&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;User Interface&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ecosystem / Third-Party Libraries&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Market and Community&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Accessing Native Device Features&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Supported Platforms&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Popular Apps&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Pricing&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;1. The Language Stack&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;With this metric, I want to explore which framework utilizes which programming languages and offer what benefits:&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React Native:&lt;/strong&gt; It utilizes JavaScript which is at present one of the most popular, dynamic and high-level programming language. It combines the advantages of JavaScript and React.JS and is backed by Facebook.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The solid side of React Native that makes it best among the other three frameworks in terms of PL is that it allows writing a few components in Swift, Objective-C or Java when developers require them. Utilizing native modules and libraries in React Native applications, you can manage computationally heavy operations like video handling or image editing.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic framework:&lt;/strong&gt; It uses HTML5, CSS, and JS to develop and run applications, and requires Cordova wrapper to access native platform controllers. Utilizing IONIC, you can also use TypeScript that improves the quality of the code.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flutter:&lt;/strong&gt; It utilizes Dart to develop high-quality applications for Android, iOS and the web. Dart is an amazing Programming language that offers plenty of benefits and is based on C/C++ and java. Despite being new, the language is soon expected to take the industry by storm.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here is how you can rank these frameworks based on the advantages offered by their programming languages:&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;React Native (React)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Flutter (Dart)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic Framework (Angular)&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;2. Do not repeat yourself (DRY)&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;With this metric, I want to explore how much of the code you write can be re-used for both platforms.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic:&lt;/strong&gt; Awesome re-usability! The “wrapped web app” concept ensures that you can easily re-use your code — you’re just building a wrapped web app in the end. The great component library of adaptive components (i.e. automatically styled for the platform the app runs on) also helps.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flutter:&lt;/strong&gt; Also really great to re-use. The widgets it ships with often don’t adapt to the underlying platform, instead you use &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fmaterial.io%2Fdesign%2F" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Material Design&lt;/a&gt; on both platforms by default. The Flutter team is providing more and more iOS-styled components though. You can find out on which platform you’re running and manually swap widgets but that’s, of course, a bit more work than required by Ionic. If you need platform-specific re-styling, you can move the position of Flutter on the slider further to the right.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React Native:&lt;/strong&gt; Also compiles to native defaults but only provides a basic set of components to start with. You have to style most of them on your own, hence more work is required to achieve appropriate styles on both platforms. Generally, code can be re-used though (since you still only use one language and libraries like &lt;a href="https://medium.com/r/?url=http%3A%2F%2Fredux.js.org%2F" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Redux&lt;/a&gt; need no adjustment).&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here is how you can rank these frameworks based on the Code Reusability&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Ionic Framework&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Flutter&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;React Native&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;3. Rich pre-styled Component Library&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;How easy is it to build beautiful UIs? Do you have to create and style a lot of components (UI elements) on your own or do you have a rich suite of pre-built ones? Are the components adapting to the underlying platform automatically? That’s what this metric is about.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic:&lt;/strong&gt; Ionic in its core is a big set of pre-built (and pre-styled) components. The compiler/ toolchain which yields a native app is also part of the Ionic package (handled via its CLI) but it utilizes other packages like &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fcordova.apache.org%2F" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Cordova&lt;/a&gt; or &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fcapacitor.ionicframework.com%2F" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Capacitor&lt;/a&gt;. The components provided by Ionic automatically adapt to the platform the app runs on and therefore, Ionic makes the creation of beautiful, native-looking apps a breeze!&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flutter:&lt;/strong&gt; Flutter also ships with a &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fflutter.io%2Fwidgets%2F" class="markup--anchor markup--p-anchor" rel="noopener"&gt;comprehensive suite&lt;/a&gt; of built-in widgets. These mostly use the Material Design, some Cupertino-style (iOS style) widgets exist, too. More and more iOS-styled components are getting added. With all these widgets, you can quickly create nice-looking UIs without doing too much manual styling. Only if you need different looks for different platforms, some effort can be required since the widgets don’t adapt automatically.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React Native:&lt;/strong&gt; A decent set of built-in components is provided but a lot of them need to be styled by you. And they’re non-adaptive, instead — just as with Flutter — you get alternatives for both operating systems. That requires adjustments in your code, where you have to choose, use and style widgets conditionally.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here is how you can rank these frameworks based on the pre-styled Component Library&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Ionic Framework&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Flutter&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;React Native&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;4. Performance&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;This metric is the most important one and speaks for itself — how do the apps made in different frameworks perform from a run-time performance perspective?&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React Native:&lt;/strong&gt; The performance it provides is very similar to native applications as it renders code elements specifically to the native APIs. React additionally allow developers to use native modules written in native languages to write code for complicated operations. However, they can’t be reused across two platforms; their main purpose is to provide higher performance.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic:&lt;/strong&gt; In terms of performance, Ionic loses the game. Its performance isn’t as similar to React Native or flutter offers since it utilizes web technologies to render an application. This approach significantly decreases the speed. Also, it doesn’t utilize native components and tries to create a native look and feel by using web technologies.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The upside of Ionic is its quick testing process that runs instantly in a browser that streamlines the development process.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Ionic offers a poorer performance among these 3 as it’s a wrapped web app in the end. &lt;strong class="markup--strong markup--p-strong"&gt;But this is often misunderstood!&lt;/strong&gt; “Worse” sounds extremely bad but “worse” doesn’t actually mean “horrible” or even “bad”. Instead, you got worse performance than with the other approaches. In fact, on the devices we got these days, your app will probably run more than smooth! If you only (imaginary!) got 100fps instead of 105fps — would you notice a difference? You wouldn’t, so &lt;strong class="markup--strong markup--p-strong"&gt;keep Ionic in your mind for your next app!&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flutter:&lt;/strong&gt; When compared on the basis of app performance, it is the Flutter that takes the crown over its competitors. Because it has advantages of Dart and there is no JavaScript bridge for starting interactions with the device native components, the speed it offers is amazing.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here is how you can rank these frameworks based on the performance they offer:&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Flutter&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;React Native&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;5. User Interface&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Users judge apps within the first few seconds of usage and that’s why GUI of an app must be engaging while being easy — let’s see what these frameworks offer:&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React Native:&lt;/strong&gt; React Native modules associated with native UI controllers, which gives amazing user experience that is very close to native apps. It additionally utilizes the ReactJS library with extensive UI elements and streamlines the UI development.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic:&lt;/strong&gt; Ionic UI doesn’t utilize native elements at all and renders everything in HTML and CSS. Then it applies Cordova to give native mobile experience. Angular components that accompany the framework also enable Ionic apps look like the native ones.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flutter: &lt;/strong&gt;Flutter provides the best User Interfaces&lt;strong class="markup--strong markup--p-strong"&gt;. &lt;/strong&gt;No doubt Ionic give us cross-platform apps but their efficiency and performance cannot beat Flutter and React Native. They stuck and lack in responsiveness if an app is heavy and more native UI components are used.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here is how you can rank these frameworks based on the UI they offer:&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Flutter&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;React Native&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;6. Ecosystem / Third-Party Libraries&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;What does the ecosystem look like? Is it easy to find help (on &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fstackoverflow.com%2F" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Stackoverflow&lt;/a&gt; etc) and are there enough third-party libraries available to add that one feature your app needs?&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic:&lt;/strong&gt; Ionic uses JavaScript for its logic — and whilst you can use it with any (or no) JavaScript framework, it provides especially great support for Angular. Therefore, you benefit from these ecosystems. And the JavaScript, as well as the Angular ecosystem, is huge! Thousands of threads on &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fstackoverflow.com%2F" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Stackoverflow&lt;/a&gt; and packages on &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fwww.npmjs.com%2F" class="markup--anchor markup--p-anchor" rel="noopener"&gt;npm&lt;/a&gt; help you solve your problems.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flutter:&lt;/strong&gt; Flutter is seeing tremendous growth! You find quite a lot of discussions on Stackoverflow and third-party libraries and packages (on &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fpub.dartlang.org%2Fflutter" class="markup--anchor markup--p-anchor" rel="noopener"&gt;its own platform&lt;/a&gt;). Despite being relatively new, it’s already quite mature and has a decent ecosystem.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React Native:&lt;/strong&gt; It uses JavaScript and React, hence you got those ecosystems available. Additionally, React Native on its own has quite a vibrant ecosystem and community, hence you find many threads on Stackoverflow and a lot of third-party packages that add missing functionalities. A downside is that you often need to rely on the ecosystem (like plugins, starters etc.) since only core features are included in React Native itself. React Native’s ecosystem in not as strong as others, and often keeps changing or the third-party plugins can’t keep pace with changing React Native&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here is how you can rank these frameworks based on the Ecosystem / Third-Party Libraries&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Ionic&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Flutter&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;React Native&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;7. Market and Community&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Having a dynamic ecosystem is something worth being thankful for — but it matters how popular is an option? Let’s see:&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React Native:&lt;/strong&gt; React Native is the king when it comes to market and community recognition. The network of its developers is quickly growing and as of now has many experienced React Native Engineers. This makes it easy to kick start a React project. It utilizes an amazingly popular library (React) and the most essential web development language (JavaScript) and provides real native applications. These qualities make it a strong platform and are the reasons behind its fame.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic:&lt;/strong&gt; It is the second most popular framework after React. It empowers developers to build native mobile apps in the fastest possible way. Ionic has a huge community support, as well as a &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fmarket.ionicframework.com" class="markup--anchor markup--p-anchor" rel="noopener"&gt;great marketplace&lt;/a&gt; where you can find a lot of starters and templates to jump start any app from &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fmarket.ionicframework.com%2Fstarters%2Ftaxi-booking-complete-platform-ionic-4" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Uber&lt;/a&gt; to &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fmarket.ionicframework.com%2Fstarters%2Fionic-4-spotify-pwa-and-app-starter" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Spotify&lt;/a&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flutter:&lt;/strong&gt; Flutter is a new framework for community right now and not very popular. But, it’s intensely advertised by Google that shows they want to make it a major thing in mobile world. Whilst it still has some tingle points, using it is fun and you can go rapidly from idea to prototype to app.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here is how you can rank these frameworks based on their industry recognition and reliability:&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;React Native&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Flutter&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;8. Accessing Native Device Features&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Your mobile apps most likely need access to some native device feature like the camera or GPS. How easy is it to get that access? And how easy is it for relatively new features (e.g. AR APIs provided by Android/ iOS)?&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic:&lt;/strong&gt; Ionic uses Cordova or its own solution, Capacitor, to give you access to native device features. It provides a &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fionicframework.com%2Fdocs%2Fnative%2F" class="markup--anchor markup--p-anchor" rel="noopener"&gt;very decent set of packages&lt;/a&gt; to access common native device functionalities like the camera. You can also write your own wrappers around native functionalities and then include them in your code of course. Also, Ionic/Cordova and/or Angular plugins are very stable, and update readily with platform updates.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flutter:&lt;/strong&gt; Over the last year, the Flutter team put a lot of effort into providing official packages for some of the most common native device features you need access to. There also is a very vibrant ecosystem and hence you find a package for pretty much any native feature you might want to access. You can also write and connect real native code if you need to.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React Native:&lt;/strong&gt; Being the most popular solution, you find a rich set of third-party packages as well as some built-in APIs for accessing native platform functionalities. Relying on third-party packages (which you mostly have to do) of course has the disadvantage that the core maintainers of that package might quit, hence the support is not on the same level as it is with Ionic or NativeScript.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here is how you can rank these frameworks based on the Accessing Native Device Features :&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Flutter&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;React Native&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;9. Supported Platforms&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React Native:&lt;/strong&gt; Android 4.1+ , iOS 8+&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic:&lt;/strong&gt; Android 4.4+ , iOS 8+ , Windows 10&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flutter&lt;/strong&gt;: Not sure&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;10. Popular Apps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React Native:&lt;/strong&gt; Facebook, Instagram, UberEats, Airbnb (they later removed RN from usage. Read More here — &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fsoftwareengineeringdaily.com%2F2018%2F09%2F24%2Fshow-summary-react-native-at-airbnb%2F" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Why Airbnb left React Native&lt;/a&gt;)&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic:&lt;/strong&gt; JustWatch, Pacifica, Nationwide and many more.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flutter:&lt;/strong&gt; Hamilton&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;11. Pricing&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React Native:&lt;/strong&gt; Completely open-source frameworks. Engineers can utilize this system and their libraries for free.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Flutter: &lt;/strong&gt;Completely open-source frameworks. Engineers can utilize this system and their libraries for free.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic:&lt;/strong&gt; It is a free open source framework for developing cross-platform mobile applications. But, the organization offers its Pro Development Environment which is paid. The company guarantees that Ionic Pro accelerates the development process.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Final Words&lt;/h3&gt;
&lt;h4 class="graf graf--h4 graf-after--h3"&gt;Which Framework Is Best, When, And Why?&lt;/h4&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--LlmJx1TZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2ANtbHYbdIapeJ1kmQcBLH-Q.png"&gt;A broad comparison tell us this much&lt;p class="graf graf--p graf-after--figure"&gt;Ionic is popular for its easy learning curve due to web technologies while Flutter requires developers learning Dart to build apps. Also, Ionic is not a preferable choice for intense graphical apps or game development because of wrapper plugins that cause performance issues sometimes. Flutter is new and gradually growing with the support from best developers of Google and the community.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p is-selected"&gt;But, let us say that all these frameworks are best at their own. While choosing a framework for your cross-platform app development, you need to analyze many factors like budget, time, application size, platforms, and so on.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Let us know your views on different frameworks via comments below.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learnt the major differences between Ionic framework, react native and flutter for mobile app development.&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;How To in React Native — &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fenappd.com%2Fblog%2Fpick-images-from-camera-gallery-in-react-native-app%2F78" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image picker&lt;/a&gt;| &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fenappd.com%2Fblog%2Fintergrate-firebase-in-react-native-app%2F73" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Integrate Firebase&lt;/a&gt; | &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fenappd.com%2Fblog%2Freact-native-firebase-crud-image-upload-and-phone-authentication%2F86" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Push notifications&lt;/a&gt; | &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fenappd.com%2Fblog%2Fgeolocation-geocoding-react-native-apps%2F84" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fenappd.com%2Fblog%2Freact-native-life-cycle-hooks%2F79" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Life cycle hooks&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To in Ionic — &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fenappd.com%2Fblog%2Fimage-picker-in-ionic-4-app%2F67%2F" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image picker&lt;/a&gt;| &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fenappd.com%2Fblog%2Fhow-to-integrate-firebase-in-ionic-4-apps%2F23%2F" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Integrate Firebase&lt;/a&gt; | &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fenappd.com%2Fblog%2Fimplement-ionic-4-firebase-push%2F34%2F" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Push notifications&lt;/a&gt; | &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fenappd.com%2Fblog%2Fusing-geolocation-geocoding-and-reverse-geocoding-in-ionic-4%2F45%2F" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fenappd.com%2Fblog%2Fadding-video-player-in-ionic-4-app%2F64%2F" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Video Player&lt;/a&gt;| &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fenappd.com%2Fblog%2Frtl-right-to-left-use-in-ionic-4%2F50%2F" class="markup--anchor markup--li-anchor" rel="noopener"&gt;RTL&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://medium.com/r/?url=https%3A%2F%2Fenappd.com%2Fblog%2Fguide-on-react-native-full-app%2F53" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://medium.com/r/?url=http%3A%2F%2Fenappd.com%2Fblog%2Fionic-4-full-app-how-to-make-ionic-4-apps-from-the-super-template%2F14%2F" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Awesome Apps in&lt;/a&gt; IONIC 4 using Full App&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next Ionic 4 app, you can make your next awesome app using &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fstore.enappd.com%2Fproduct%2Fionic-4-full-app%2F" class="markup--anchor markup--p-anchor" rel="noopener nofollow noopener noopener nofollow noopener noopener nofollow noopener noopener noopener noopener noopener"&gt;Ionic 4 Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--IFbNjPgI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A2BzL8TesnBHuazHr3VA4SQ.jpeg"&gt;&lt;span class="defaultValue"&gt;Type caption for image (optional)&lt;/span&gt;&lt;br&gt;&lt;p class="graf graf--p graf-after--figure"&gt;If you need a base to start your next React Native app, you can make your next awesome app using &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fstore.enappd.com%2Fproduct%2Freact-native-full-app%2F" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CF89hkbC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AsWyEeAfCMk7ULOkLUCdSug.jpeg"&gt;&lt;span class="defaultValue"&gt;Type caption for image (optional)&lt;/span&gt;&lt;br&gt;&lt;p class="graf graf--p graf-after--figure"&gt;If you need a base to start your next Flutter app, you can make your next awesome app using &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fstore.enappd.com%2Fproduct%2Fflutter-full-app%2F" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Flutter Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--hfGdc0Dg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2Am1R2sLQploihax1Vu99GQA.jpeg"&gt;&lt;span class="defaultValue"&gt;Type caption for image (optional)&lt;/span&gt;&lt;br&gt;TitleSubtitleKicker&lt;span class="svgIcon svgIcon--addMediaPlus svgIcon--25px"&gt;&lt;/span&gt;&lt;span class="svgIcon svgIcon--addMediaImage svgIcon--25px"&gt;&lt;/span&gt;&lt;span class="svgIcon svgIcon--search svgIcon--25px"&gt;&lt;/span&gt;&lt;span class="svgIcon svgIcon--addMediaVideo svgIcon--25px"&gt;&lt;/span&gt;&lt;span class="svgIcon svgIcon--addMediaEmbed svgIcon--25px"&gt;&lt;/span&gt;&lt;span class="svgIcon svgIcon--addMediaPart svgIcon--25px"&gt;&lt;/span&gt;

</description>
      <category>reactnative</category>
      <category>flutter</category>
      <category>ionic</category>
      <category>comparison</category>
    </item>
    <item>
      <title>Facebook login in React Native apps</title>
      <dc:creator>Umang Darji</dc:creator>
      <pubDate>Fri, 27 Mar 2020 03:49:53 +0000</pubDate>
      <link>https://forem.com/enappd/facebook-login-in-react-native-apps-4p54</link>
      <guid>https://forem.com/enappd/facebook-login-in-react-native-apps-4p54</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;In this post, you will learn how to implement a Facebook authentication in React native apps.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;We will cook a sample app, where users can log in using their Facebook account. After login, the user can see their basic profile information on the home page.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;em class="markup--em markup--blockquote-em"&gt;Complete source code of this tutorial is available in the &lt;/em&gt;&lt;a href="https://github.com/enappd/facebook-login-rn.git" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;React-native-facebook-Login-Starter&lt;/em&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Social logins — What and why&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3 is-selected"&gt;It’s helpful to use social sign-in with React Native for your users who would rather not create and remember another username/password combination. Instead, you can allow users to sign in with accounts they already own. You don’t need to store hashed passwords to compare, you don’t have to handle sending sign up emails, and you don’t need to reset passwords. The user’s chosen provider will handle all of this for you. Plus, in mobile apps, the Facebook login is automatically done with the pre-installed Facebook app.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Facebook login — What and why&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;There are several reasons why you should use a Facebook login in your app&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Ease of use&lt;/strong&gt; — When a new user uses your app, only two buttons clicks are required to log in using Facebook. In another scenario, the user will have to type in an email/password and login&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;No “forgot password” &lt;/strong&gt;— When your app uses Facebook login, the user does not have to worry about forgetting the password for your app’s login&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;No “verify email”&lt;/strong&gt; — If you use a custom-email authentication of your own, you will have to verify the email if it is a valid one or not. Facebook login will always have a valid email/phone number associated.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Single solution — &lt;/strong&gt;Facebook log in can allow your users to use single login credentials across multiple devices&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Facebook integration&lt;/strong&gt; — If your app uses Facebook authentication, you can use Facebook APIs inside your app as well. This can include fetching user tweets etc.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Trust&lt;/strong&gt; — Nowadays, people generally trust social logins moreover custom email logins. Social logins follow standard privacy protocols and hence are more reliable for information sharing&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;React Native Authentication&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;The React Native has been around for around 5 years and has been very popular among developers for its ease of usage over Swift / Java. Plus it requires you to have single source code for both an Android and an iOS app. What more can a developer ask for!&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;There are several ways of Authentication in React Native apps&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Social logins &lt;/strong&gt;— Social logins are a popular and easy way of authentication in mobile apps. You must have seen Google, Facebook, Instagram logins in almost all the modern apps. Social logins are easy to use and more reliable for quick integrations.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Back-end as a Service (BaaS) — &lt;/strong&gt;You&lt;strong class="markup--strong markup--li-strong"&gt; &lt;/strong&gt;can use pre-built BaaS platforms which allows easy integration of authentication in your apps. Basically, these platforms provide you a ready-made back-end, so you don’t have to make one on your own. Firebase, Parse, Back4App are some BaaS platforms.&lt;strong class="markup--strong markup--li-strong"&gt;&lt;em class="markup--em markup--li-em"&gt;Firebase&lt;/em&gt;&lt;/strong&gt; is the most popular among these for mobile apps&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Create your own back-end&lt;/strong&gt; — You can create your own back-end in Node.js, Go, Django or Ruby-on-rails, and connect your app authentication to your own back-end. This method is favored by developers who need full control over user authentication. But this method is the most time taking one as well.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;Steps for Facebook authentication&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;We will follow these step-by-step instructions to create our React Native app with Facebook authentication&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 1: Create a basic React Native app&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 2: Facebook Developer Console — Create your app&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;‌‌&lt;strong class="markup--strong markup--p-strong"&gt;Step 3: Add your Platforms to Facebook&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;‌&lt;strong class="markup--strong markup--p-strong"&gt;Step 4: Install the React Native FBSDK&lt;/strong&gt; &lt;strong class="markup--strong markup--p-strong"&gt;to connect your app with Facebook&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 5: Running Apps&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 6: Authenticate Users using Facebook&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 7: Test your app on Android&lt;/strong&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;1. Create a basic React Native app&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;First, make sure you have all pre-requisites to create a react-native app as per the &lt;a href="https://facebook.github.io/react-native/docs/getting-started.html" class="markup--anchor markup--p-anchor" rel="noopener"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;At the time of this post, I have React-Native version 0.60&lt;/strong&gt;&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Create a blank react-native app (Replace &lt;code class="markup--code markup--p-code"&gt;myApp&lt;/code&gt; with your own name)&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;$ react-native init myApp&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;This will create a basic React-native app which you can run in a device or simulator. (either Android or iOS)&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 2: Facebook Developer Console&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;The first thing we need to do is to create a new application in Facebook’s developer dashboard, and this app is the one that Facebook will use to ask our users for their permission when we try to log them into our React Native application.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;For that, you’ll need to go to the &lt;a href="https://developers.facebook.com/apps" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;F&lt;/strong&gt;&lt;/a&gt;&lt;a href="https://developers.facebook.com/apps" class="markup--anchor markup--p-anchor" rel="noopener noreferrer noopener noopener noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;acebook developer console&lt;/strong&gt;&lt;/a&gt; and create a new app.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--nrvZMhBD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2A25XkXnSODKdAfMqY"&gt;&lt;br&gt;Create a new app in Facebook Developer console&lt;p class="graf graf--p graf-after--figure"&gt;Once we finish creating our app, we will go to the Facebook app dashboard and pick &lt;strong class="markup--strong markup--p-strong"&gt;App Id&lt;/strong&gt; from there. It will be required in installing the Facebook plugin in the app&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ndWO97gH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AQT4zATT8m2s_NfQI"&gt;&lt;br&gt;Facebook Developer Console — App ID on top-left&lt;h3 class="graf graf--h3 graf-after--figure"&gt;‌‌Step 3: Add your Platforms to Facebook&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;We need to let Facebook know which platforms we’ll be using (&lt;em class="markup--em markup--p-em"&gt;if it’s just web, iOS, or Android&lt;/em&gt;).&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;‌In our case, we will add all platforms iOS and Android.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;‌To add the platforms, go ahead inside your Facebook dashboard and click on &lt;strong class="markup--strong markup--p-strong"&gt;Settings&lt;/strong&gt;, then right below the app’s information you’ll see a button that says &lt;strong class="markup--strong markup--p-strong"&gt;Add Platform&lt;/strong&gt;, click it.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;You’ll see several options for the platforms you’re creating&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--yK_zUB4w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2A0VnMWKBszvJ5iwCf"&gt;&lt;br&gt;Options to create platforms&lt;h4 class="graf graf--h4 graf-after--figure"&gt;Add Platforms in Facebook dashboard&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;‌ &lt;strong class="markup--strong markup--p-strong"&gt;Let’s start with iOS:-&lt;/strong&gt; You’ll see a form asking you for some information, right now we just need the &lt;code class="markup--code markup--p-code"&gt;Bundle ID&lt;/code&gt;.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--vX6RkQY_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AaCcsrSi7qQNWASm0"&gt;&lt;br&gt;Create iOS app in Facebook console&lt;p class="graf graf--p graf-after--figure"&gt;‌Once you add the Bundle ID, just follow the process to create the app.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;‌&lt;strong class="markup--strong markup--p-strong"&gt;Android:-&lt;/strong&gt; The difference is that instead of &lt;code class="markup--code markup--p-code"&gt;Bundle ID&lt;/code&gt;, Android calls it “Google Play Package Name.”&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;‌Step 4: Install the React Native FBSDK to connect your app with Facebook&lt;/h3&gt;
&lt;h4 class="graf graf--h4 graf-after--h3"&gt;Installation&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Install JavaScript packages&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Install the &lt;code class="markup--code markup--p-code"&gt;react-native-fbsdk&lt;/code&gt; package:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;yarn add react-native-fbsdk&lt;/pre&gt;
&lt;blockquote class="graf graf--blockquote graf-after--pre"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;Or, if using npm:&lt;/em&gt;&lt;/blockquote&gt;
&lt;pre class="graf graf--pre graf-after--blockquote"&gt;npm install react-native-fbsdk&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Finally, link the SDK to configure the iOS and Android projects:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;react-native link react-native-fbsdk&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;Configure projects&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Android&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Assuming you have &lt;a href="http://developer.android.com/sdk/index.html" class="markup--anchor markup--p-anchor" rel="nofollow noopener noopener"&gt;Android Studio&lt;/a&gt; installed, open the project with Android Studio.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Go to &lt;code class="markup--code markup--p-code"&gt;MainApplication.java&lt;/code&gt; under &lt;code class="markup--code markup--p-code"&gt;app/src/main/java/com/&amp;lt;project name&amp;gt;/&lt;/code&gt; to complete setup.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Register SDK package in method &lt;code class="markup--code markup--p-code"&gt;getPackages()&lt;/code&gt;.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import com.facebook.reactnative.androidsdk.FBSDKPackage;&lt;br&gt;// ...&lt;br&gt;private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {&lt;br&gt;    &lt;a href="http://twitter.com/Override" class="markup--anchor markup--pre-anchor" title="Twitter profile for @Override"&gt;@Override&lt;/a&gt;&lt;br&gt;    public boolean getUseDeveloperSupport() {&lt;br&gt;      return BuildConfig.DEBUG;&lt;br&gt;    }&lt;br&gt;&lt;a href="http://twitter.com/Override" class="markup--anchor markup--pre-anchor" title="Twitter profile for @Override"&gt;@Override&lt;/a&gt;&lt;br&gt;    protected List&amp;lt;ReactPackage&amp;gt; getPackages() {&lt;br&gt;      return Arrays.&amp;lt;ReactPackage&amp;gt;asList(&lt;br&gt;          new MainReactPackage(),&lt;br&gt;          new FBSDKPackage()&lt;br&gt;      );&lt;br&gt;    }&lt;br&gt;};&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Also, you need to add in your &lt;code class="markup--code markup--p-code"&gt;settings.gradle&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;include ':react-native-fbsdk'&lt;br&gt;project(':react-native-fbsdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fbsdk/android')&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Before you can run the project, follow the &lt;a href="https://developers.facebook.com/docs/android/getting-started/" class="markup--anchor markup--p-anchor" rel="nofollow noopener noopener"&gt;Getting Started Guide&lt;/a&gt; for Facebook Android SDK to set up a Facebook app. You can skip the build.gradle changes since that’s taken care of by the rnpm link step above, but make sure you follow the rest of the steps such as updating &lt;code class="markup--code markup--p-code"&gt;strings.xml&lt;/code&gt; and &lt;code class="markup--code markup--p-code"&gt;AndroidManifest.xml&lt;/code&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;iOS&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The &lt;code class="markup--code markup--p-code"&gt;react-native-fbsdk&lt;/code&gt; has been linked by &lt;code class="markup--code markup--p-code"&gt;react-native link&lt;/code&gt;. The next step will be downloading and linking the native Facebook SDK for iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Make sure you have the latest &lt;a href="https://developer.apple.com/xcode/" class="markup--anchor markup--p-anchor" rel="nofollow noopener noopener"&gt;Xcode&lt;/a&gt; installed. Open the .xcodeproj in Xcode found in the &lt;code class="markup--code markup--p-code"&gt;ios&lt;/code&gt; subfolder from your project's root directory. Now, follow &lt;em class="markup--em markup--p-em"&gt;all the steps except the pod install (Step 2)&lt;/em&gt; in the &lt;a href="https://developers.facebook.com/docs/ios/getting-started/" class="markup--anchor markup--p-anchor" rel="nofollow noopener noopener"&gt;Getting Started Guide&lt;/a&gt; for Facebook SDK for iOS. Along with &lt;code class="markup--code markup--p-code"&gt;FBSDKCoreKit.framework&lt;/code&gt;, don't forget to import &lt;code class="markup--code markup--p-code"&gt;FBSDKShareKit.framework&lt;/code&gt; and &lt;code class="markup--code markup--p-code"&gt;FBSDKLoginKit.framework&lt;/code&gt;into your Xcode project.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;If you’re using React Native’s RCTLinkingManager&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The &lt;code class="markup--code markup--p-code"&gt;AppDelegate.m&lt;/code&gt; file can only have one method for &lt;code class="markup--code markup--p-code"&gt;openUrl&lt;/code&gt;. If you're also using &lt;code class="markup--code markup--p-code"&gt;RCTLinkingManager&lt;/code&gt; to handle deep links, you should handle both results in your &lt;code class="markup--code markup--p-code"&gt;openUrl&lt;/code&gt; method.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;- (BOOL)application:(UIApplication *)app&lt;br&gt;            openURL:(NSURL *)url&lt;br&gt;            options:(NSDictionary&amp;lt;UIApplicationOpenURLOptionsKey,id&amp;gt; *)options&lt;br&gt;{&lt;br&gt;  if ([[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]) {&lt;br&gt;    return YES;&lt;br&gt;  }&lt;br&gt;if ([RCTLinkingManager application:app openURL:url options:options]) {&lt;br&gt;    return YES;&lt;br&gt;  }&lt;br&gt;return NO;&lt;br&gt;}&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;Troubleshooting&lt;/h4&gt;
&lt;blockquote class="graf graf--blockquote graf-after--h4"&gt;I cannot run the Android project.&lt;/blockquote&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--blockquote"&gt;Make sure you added the code snippet in step 3.1.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Make sure you set up a Facebook app and updated the &lt;code class="markup--code markup--li-code"&gt;AndroidManifest.xml&lt;/code&gt; and &lt;code class="markup--code markup--li-code"&gt;res/values/strings.xml&lt;/code&gt; with Facebook app settings.&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class="graf graf--blockquote graf-after--li"&gt;I get a build error stating that one of the Facebook SDK files was not found — eg. &lt;code class="markup--code markup--blockquote-code"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;FBSDKLoginKit/FBSDKLoginKit.h file not found&lt;/em&gt;&lt;/code&gt;.&lt;/blockquote&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--blockquote"&gt;Make sure that the Facebook SDK frameworks are installed in &lt;code class="markup--code markup--li-code"&gt;~/Documents/FacebookSDK&lt;/code&gt;.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Make sure that &lt;code class="markup--code markup--li-code"&gt;FBSDK[Core, Login, Share]Kit.framework&lt;/code&gt; show up in the Link Binary with Libraries section of your build target's Build Phases.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Make sure that &lt;code class="markup--code markup--li-code"&gt;~/Documents/FacebookSDK&lt;/code&gt; is in the Framework Search Path of your build target's Build Settings. You may have to select the &lt;code class="markup--code markup--li-code"&gt;All&lt;/code&gt; tab to see and search for the Framework Search Path.&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class="graf graf--blockquote graf-after--li"&gt;I get build errors like &lt;code class="markup--code markup--blockquote-code"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;Warning: Native component for "RCTFBLikeView" does not exist&lt;/em&gt;&lt;/code&gt;:&lt;/blockquote&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--blockquote"&gt;Make sure that &lt;code class="markup--code markup--li-code"&gt;libRCTFBSDK.a&lt;/code&gt; shows up in the Link Binary with Libraries section of your build target's Build Phases.&lt;/li&gt;&lt;/ul&gt;
&lt;blockquote class="graf graf--blockquote graf-after--li"&gt;I get this build error: &lt;code class="markup--code markup--blockquote-code"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;no type or protocol named UIApplicationOpenURLOptionsKey&lt;/em&gt;&lt;/code&gt;:&lt;/blockquote&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--blockquote"&gt;Your Xcode version is too old. Upgrade to Xcode 10.0+.&lt;/li&gt;&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;Step 5: Running Apps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;To run the iOS app, you should specify simulator&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;react-native run-ios — simulator=”iPhone X”&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;To run Android app, you should start emulator first, either via Android Studio or &lt;code class="markup--code markup--p-code"&gt;adb&lt;/code&gt; , then &lt;code class="markup--code markup--p-code"&gt;react-native run-android&lt;/code&gt; .&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;You’ll see the default start screen&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--UIavk9-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2ATnZfGsKdsWGBUac-0YutpA.jpeg"&gt;&lt;br&gt;Default start screen for React Native app&lt;p class="graf graf--p graf-after--figure"&gt;Change the UI of this front page by changing &lt;code class="markup--code markup--p-code"&gt;app.js&lt;/code&gt; and the page will look like this&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 6: Authenticate Users using Facebook&lt;/h3&gt;
&lt;h4 class="graf graf--h4 graf-after--h3"&gt;Usage&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Login&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import React, { Component } from 'react';&lt;br&gt;import { View } from 'react-native';&lt;br&gt;import { LoginButton, AccessToken } from 'react-native-fbsdk';&lt;br&gt;export default class Login extends Component {&lt;br&gt;  render() {&lt;br&gt;    return (&lt;br&gt;      &amp;lt;View&amp;gt;&lt;br&gt;        &amp;lt;LoginButton&lt;br&gt;          onLoginFinished={&lt;br&gt;            (error, result) =&amp;gt; {&lt;br&gt;              if (error) {&lt;br&gt;                console.log("login has error: " + result.error);&lt;br&gt;              } else if (result.isCancelled) {&lt;br&gt;                console.log("login is cancelled.");&lt;br&gt;              } else {&lt;br&gt;                AccessToken.getCurrentAccessToken().then(&lt;br&gt;                  (data) =&amp;gt; {&lt;br&gt;                    console.log(data.accessToken.toString())&lt;br&gt;                  }&lt;br&gt;                )&lt;br&gt;              }&lt;br&gt;            }&lt;br&gt;          }&lt;br&gt;          onLogoutFinished={() =&amp;gt; console.log("logout.")}/&amp;gt;&lt;br&gt;      &amp;lt;/View&amp;gt;&lt;br&gt;    );&lt;br&gt;  }&lt;br&gt;};&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Requesting additional permissions with Login Manager&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;// ...&lt;br&gt;import { LoginManager } from "react-native-fbsdk";&lt;br&gt;// ...&lt;br&gt;// Attempt a login using the Facebook login dialog asking for default permissions.&lt;br&gt;LoginManager.logInWithPermissions(["public_profile"]).then(&lt;br&gt;  function(result) {&lt;br&gt;    if (result.isCancelled) {&lt;br&gt;      console.log("Login cancelled");&lt;br&gt;    } else {&lt;br&gt;      console.log(&lt;br&gt;        "Login success with permissions: " +&lt;br&gt;          result.grantedPermissions.toString()&lt;br&gt;      );&lt;br&gt;    }&lt;br&gt;  },&lt;br&gt;  function(error) {&lt;br&gt;    console.log("Login fail with error: " + error);&lt;br&gt;  }&lt;br&gt;);&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now that the app is all connected to Facebook Auth, let’s write the actual code to call login/logout, etc functions.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;First of all, I have created a separate file &lt;code class="markup--code markup--p-code"&gt;LoginController.js&lt;/code&gt; and imported it in &lt;code class="markup--code markup--p-code"&gt;App.js&lt;/code&gt; , just to maintain a good code structure.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--_-m63UPr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AM3YY9WkBmpmz6H-ZAiNKMw.png"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;My &lt;code class="markup--code markup--p-code"&gt;App.js&lt;/code&gt; looks like following (nothing fancy, I’m not even gonna waste a gist here)&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import React, { Fragment } from 'react';&lt;br&gt;import LoginController from './LoginController';&lt;br&gt;const App = () =&amp;gt; {return (&amp;lt;LoginController/&amp;gt;);};&lt;br&gt;export default App;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Yes, that’s it 😆&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;5.1 Implement a Facebook login button&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;In the &lt;code class="markup--code markup--p-code"&gt;LoginController.js&lt;/code&gt; , I add the Facebook login button using the following code&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import { LoginButton, AccessToken } from 'react-native-fbsdk';&lt;br&gt;.....(inside render)&lt;br&gt; &amp;lt;LoginButton&lt;br&gt;          onLoginFinished={&lt;br&gt;            (error, result) =&amp;gt; {&lt;br&gt;              if (error) {&lt;br&gt;                console.log("login has error: " + result.error);&lt;br&gt;              } else if (result.isCancelled) {&lt;br&gt;                console.log("login is cancelled.");&lt;br&gt;              } else {&lt;br&gt;                AccessToken.getCurrentAccessToken().then(&lt;br&gt;                  (data) =&amp;gt; {&lt;br&gt;                    console.log(data.accessToken.toString())&lt;br&gt;                  }&lt;br&gt;                )&lt;br&gt;              }&lt;br&gt;            }&lt;br&gt;          }&lt;br&gt;          onLogoutFinished={() =&amp;gt; console.log("logout.")}/&amp;gt;&lt;br&gt;....&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;This shows the beautiful Facebook-Button as per their marketing guidelines.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Overall, my &lt;code class="markup--code markup--p-code"&gt;LoginController.js&lt;/code&gt; file looks like this (a bit long, I know)&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--Yxq2vozR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AESdpmUFHeFV_9g-3xxMRtg.jpeg"&gt;&lt;br&gt;Before Login&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--Q48J_YAo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AVDRkgnqlJhbf4P3pbdyc5Q.jpeg"&gt;&lt;br&gt;After login&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 7: Test your app on Android&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Let’s now build the app for iOS. I am using a simulator, but you can always use a real device as well.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Run the app on Android simulator using&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;react-native run-android&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Here’s how my Facebook Login app works&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--hLiCClqX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AKXhqHpz_VF8_1OjHpofGxg.gif"&gt;&lt;br&gt;Facebook Working&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this post, you learned how to implement Facebook login in your React Native app.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;em class="markup--em markup--blockquote-em"&gt;Complete source code of this tutorial is available in the &lt;/em&gt;&lt;a href="https://github.com/enappd/facebook-login-rn.git" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;React-native-facebook-Login-Starter&lt;/em&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learnt about setting up Push Notifications in React Native apps, here are some other topics you can look into&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Firebase — &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Integrate Firebase&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-analytics-in-react-native-app/101" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Analytics&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Push notifications&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Firebase CRUD&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To in React Native — &lt;a href="https://enappd.com/blog/geolocation-geocoding-react-native-apps/84" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/pick-images-from-camera-gallery-in-react-native-app/78" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Redux implementation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-make-api-calls-in-react-native-apps/125" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Make API calls&lt;/a&gt; | &lt;a href="https://enappd.com/blog/navigations-in-react-native-app/124" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Navigation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-translate-in-react-native-app-globalization-internationalization-and-text-to-speech/120" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Translation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-qr-code-scanning-using-react-native-camera/117" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Barcode &amp;amp; QR code scan&lt;/a&gt; | &lt;a href="https://enappd.com/blog/send-read-and-delete-sms-in-react-native/107" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Send &amp;amp; Read SMS&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-vision-with-react-native/96" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Vision&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Payments — &lt;a href="https://enappd.com/blog/implement-apple-pay-in-react-native-apps/93" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/stripe-integration-in-react-native-apps-using-firebase/108" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe payments&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Authentication — &lt;a href="https://enappd.com/blog/google-login-in-react-native-android-apps-with-firebase/90" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Google Login&lt;/a&gt;| &lt;a href="https://enappd.com/blog/facebook-login-in-react-native-apps/89" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Facebook login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Phone Auth&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-react-native-apps-using-firebase/95" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/anonymous-login-in-react-native-apps-with-firebase/129" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous Login&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-make-stories-ui-like-instagram-and-whatsapp-in-react-native/123" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Instagram / Whatsapp Story Feature in React Native&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;React Native life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Implement Redux&lt;/a&gt; | &lt;a href="https://enappd.com/blog/async-actions-with-redux-thunk-middleware-in-react-native-apps-1/100" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Async actions with Redux&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/guide-on-react-native-full-app/53" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next React Native app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/react-native-full-app/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CF89hkbC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AsWyEeAfCMk7ULOkLUCdSug.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>facebook</category>
      <category>login</category>
    </item>
    <item>
      <title>What’s new in Ionic React RC (and how to use it)</title>
      <dc:creator>Umang Darji</dc:creator>
      <pubDate>Fri, 27 Mar 2020 01:30:17 +0000</pubDate>
      <link>https://forem.com/enappd/what-s-new-in-ionic-react-rc-and-how-to-use-it-3b17</link>
      <guid>https://forem.com/enappd/what-s-new-in-ionic-react-rc-and-how-to-use-it-3b17</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;If you are here, that means you have already heard about Ionic React RC is now out! and you are searching for &lt;strong class="markup--strong markup--p-strong"&gt;how to create Ionic apps in react using Ionic React&lt;/strong&gt;. If that’s true, then you are in the right place. Here I would be creating an Ionic app in React Using Ionic React. Need not worry, I would be taking you step by step how to make Ionic apps in React Using Ionic React.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The team behind Ionic announced the RC release of Ionic React. Developers can now make use of all the Ionic components in their React application. Ionic React ships with almost 70 components including buttons, cards, menus, tabs, alerts, modals, and much more. It also supports TypeScript type definitions.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is Ionic? and why is Ionic React special&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Ionic is an open source framework that consists of UI components for building cross-platform applications. These components are written in HTML, CSS, and JavaScript and can easily be deployed natively to iOS and Android devices, desktop with Electron, or to the web as a progressive web app.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Historically, Ionic has been associated with Angular, but this changed with its recent release, Ionic 4. Now, developers can use the Ionic app development framework alongside any frontend framework. The Ionic team has been working towards making Ionic work with React and Vue for a long time. React developers already have React Native to make native apps for &lt;a href="https://subscribe.packtpub.com/learn-ios/" class="markup--anchor markup--p-anchor" title="Learn iOS Development" rel="noopener"&gt;iOS&lt;/a&gt; and &lt;a href="https://subscription.packtpub.com/tech/android" class="markup--anchor markup--p-anchor" title="Android eBooks, Courses &amp;amp; Videos" rel="noopener"&gt;Android&lt;/a&gt;, but with Ionic React they will also be able to create hybrid mobile, desktop, and progressive web apps. In the future, the team is also planning to make React Native and Ionic work together.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The Ionic team also recommends users to use TypeScript in their apps to get a better developer experience.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Ionic and React&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;&lt;a href="https://ionicframework.com/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic&lt;/strong&gt;&lt;/a&gt; has been gaining popularity in the last few years, and rightfully so. Making apps in Ionic is a breeze compared to Native languages (Java / Swift). Ionic framework’s domain encompasses a huge variety of mobile app features which can create almost 90% of the apps today.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;a href="https://reactjs.org/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React JS&lt;/strong&gt;&lt;/a&gt; has come at a good time helping the developers to build highly engaging web apps and user interfaces quickly and efficiently. It allows you to break down the components and create a single page application with less coding. It is mostly popular for its shadow DOM, which it uses for limited scope DOM manipulation, which makes React apps faster. It is due to these major &lt;strong class="markup--strong markup--p-strong"&gt;advantages&lt;/strong&gt; that &lt;strong class="markup--strong markup--p-strong"&gt;React JS&lt;/strong&gt; has gained much spotlight.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;For many years Ionic was stuck with Angular framework. But with Ionic 4, it has broken free of the framework restriction. Now Ionic 4 supports Angular, React and Vue JS frameworks.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In February 2019 the Ionic team announced &lt;a href="https://ionicframework.com/blog/announcing-the-ionic-react-beta/" class="markup--anchor markup--p-anchor" rel="noopener noreferrer noopener noopener"&gt;Beta of Ionic React&lt;/a&gt;. Ionic React allows you to make your react frontend builds run everywhere, for example, iOS, Android, Electron and in the browser as a progressive web application (PWA) using any underlying framework.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Why is Ionic React needed&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Explaining the motivation behind Ionic React, Ely Lucas, Software Engineer &amp;amp; Dev Advocate at Ionic wrote in the &lt;a href="https://ionicframework.com/blog/announcing-ionic-react-release-candidate/" class="markup--anchor markup--p-anchor" rel="noopener noreferrer noopener noopener"&gt;announcement&lt;/a&gt;,&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf--startsWithDoubleQuote graf-after--p"&gt;“&lt;em class="markup--em markup--blockquote-em"&gt;Ionic React RC marks the first major release of our vision to bring Ionic development to more developers on other frameworks&lt;/em&gt;.”&lt;/blockquote&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--blockquote"&gt;Though it is possible to import the core Ionic components directly into React projects, this method does not provide a good developer experience. Also, when working with web components in React, you need to write some boilerplate code to properly communicate with the web components.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic React will essentially work as a “thin wrapper” around the core components of Ionic and will export them as native React components. It will also handle the boilerplate code for you. However, you still need to write a few features in the native framework such as page lifetime management and lifecycle methods. You can do this by extending the &lt;strong class="markup--strong markup--li-strong"&gt;react-router&lt;/strong&gt; package with &lt;strong class="markup--strong markup--li-strong"&gt;@ionic/react-router&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;Considering this is a release candidate, the team is not expecting many major changes. Sharing the team’s next steps, Lucas said,&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf--startsWithDoubleQuote graf-after--p"&gt;
&lt;em class="markup--em markup--blockquote-em"&gt;“We will be looking closely at any issues that pop up during the RC phase and working on some final code stabilization and minor bug fixes…We also plan on creating some more content and guides in the docs to help with some best practices we’ve found when working with Ionic React.&lt;/em&gt;”&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;The team is now seeking developer feedback before they come up with the final release. If you encounter any issues, you can report it on the &lt;a href="https://github.com/ionic-team/ionic/issues" class="markup--anchor markup--p-anchor" rel="noopener noreferrer noopener noopener"&gt;GitHub repo&lt;/a&gt; and tag the issue with “package react”.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;To know further updates on Ionic React, you can also have a chat with the team who will be present at &lt;a href="https://www.reactrally.com/" class="markup--anchor markup--p-anchor" rel="noopener noreferrer noopener noopener"&gt;React Rally&lt;/a&gt; from August 22–23 at Salt Lake City, UT. This is a community conference that brings together developers of all backgrounds using React.js, React Native and related tools.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;We at &lt;a href="http://enappd.com" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Enappd&lt;/a&gt;, already have an &lt;a href="https://store.enappd.com/product/ionic-react-full-app-capacitor/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Ionic-React Starter Kit&lt;/a&gt; with beta version. We are quickly updating it to work with RC version.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Getting Started&lt;/h3&gt;
&lt;h4 class="graf graf--h4 graf-after--h3"&gt;1. Create a new react Project&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;If you haven’t already done so, grab the latest &lt;a href="https://ionicframework.com/blog/ionic-cli-v5-brings-react-beta-support/" class="markup--anchor markup--p-anchor" rel="noopener noreferrer noopener noopener"&gt;v5 release&lt;/a&gt; of the Ionic CLI:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;npm i ionic -g&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;And create an Ionic React project by specifying the type of “react”:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;ionic start MyReactApp --type=react&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;You will see that all of our standard starter templates are there, choose your favorite (I’ll choose a blank).&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;[INFO] Next Steps:[INFO] Next Steps:&lt;br&gt;- Go to your cloned project: cd .\MyReactApp&lt;br&gt;       - Run ionic serve within the app directory to see your app&lt;br&gt;       - Build features and components: &lt;a href="https://ion.link/scaffolding-docs" class="markup--anchor markup--pre-anchor" rel="nofollow noopener noopener"&gt;&lt;/a&gt;&lt;a href="https://ion.link/scaffolding-docs"&gt;https://ion.link/scaffolding-docs&lt;/a&gt;&lt;br&gt;       - Get Ionic DevApp for easy device testing: &lt;a href="https://ion.link/devapp" class="markup--anchor markup--pre-anchor" rel="nofollow noopener noopener"&gt;&lt;/a&gt;&lt;a href="https://ion.link/devapp"&gt;https://ion.link/devapp&lt;/a&gt;&lt;br&gt;- Go to your cloned project: cd .\MyReactApp&lt;br&gt;       - Run ionic serve within the app directory to see your app&lt;br&gt;       - Build features and components: &lt;a href="https://ion.link/scaffolding-docs" class="markup--anchor markup--pre-anchor" rel="nofollow noopener noopener"&gt;&lt;/a&gt;&lt;a href="https://ion.link/scaffolding-docs"&gt;https://ion.link/scaffolding-docs&lt;/a&gt;&lt;br&gt;       - Get Ionic DevApp for easy device testing: &lt;a href="https://ion.link/devapp" class="markup--anchor markup--pre-anchor" rel="nofollow noopener noopener"&gt;&lt;/a&gt;&lt;a href="https://ion.link/devapp"&gt;https://ion.link/devapp&lt;/a&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;2. Open the Project in the code editor of your choice&lt;/h4&gt;
&lt;pre class="graf graf--pre graf-after--h4"&gt;&lt;code class="markup--code markup--pre-code"&gt;$ cd react-ionic&lt;br&gt;$ code .&lt;/code&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;3. Run the project in the browser&lt;/h4&gt;
&lt;pre class="graf graf--pre graf-after--h4"&gt;ionic serve&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;This command will search start script in your &lt;code class="markup--code markup--p-code"&gt;package.json&lt;/code&gt; file and run the command you mentioned in your start script. E.g.&lt;/p&gt;
&lt;pre class="graf graf--pre graf--startsWithDoubleQuote graf-after--p"&gt;“start”: “react-scripts start”&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;&lt;em class="markup--em markup--p-em"&gt;react-scripts start&lt;/em&gt;&lt;/strong&gt; will build your code in development mode and run it on your browser&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ncmTr02S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AjvDx_TUou5cSXdFyODUp0Q.jpeg"&gt;&lt;br&gt;Ionic Blank Starter&lt;p class="graf graf--p graf-after--figure"&gt;so now you can see this screen on your browser&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;4. A look at a Package.json&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Packages published to the registry must contain a &lt;code class="markup--code markup--p-code u-paddingRight0 u-marginRight0"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;package&lt;/strong&gt;.&lt;strong class="markup--strong markup--p-strong"&gt;json&lt;/strong&gt;&lt;/code&gt;&lt;strong class="markup--strong markup--p-strong"&gt; file&lt;/strong&gt;. A &lt;code class="markup--code markup--p-code u-paddingRight0 u-marginRight0"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;package&lt;/strong&gt;.&lt;strong class="markup--strong markup--p-strong"&gt;json&lt;/strong&gt;&lt;/code&gt;&lt;strong class="markup--strong markup--p-strong"&gt; file&lt;/strong&gt; lists the packages your project depends on, specifies versions of a &lt;strong class="markup--strong markup--p-strong"&gt;package&lt;/strong&gt; that your project can use, using&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;semantic versioning rules.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;At first glance it may look like there’s a lot going on, so let’s break it down, starting with the first three lines.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;So what’s going on here? Well, the first three lines are very basic info about projects like name and version. The first being Name itself.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;"name": "my-ionic-app",&lt;br&gt;"version": "0.1.0",&lt;br&gt;"private": true,&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Required name and version fields&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;A &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;package.json&lt;/strong&gt;&lt;/code&gt; file must contain &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;name&lt;/strong&gt;&lt;/code&gt; and &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;version&lt;/strong&gt;&lt;/code&gt; fields.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;name&lt;/strong&gt;&lt;/code&gt; field contains your package’s name, and must be lowercase and one word, and may contain hyphens and underscores.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;version&lt;/strong&gt;&lt;/code&gt; field must be in the form &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;x.x.x&lt;/strong&gt;&lt;/code&gt; and follow the &lt;a href="https://docs.npmjs.com/about-semantic-versioning" class="markup--anchor markup--p-anchor" rel="noopener"&gt;semantic versioning guidelines&lt;/a&gt;.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;The next block is &lt;code class="markup--code markup--h4-code"&gt;dependencies&lt;/code&gt;.&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Please do not put test harnesses or transpilers in your &lt;/strong&gt;&lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;dependencies&lt;/strong&gt;&lt;/code&gt;&lt;strong class="markup--strong markup--p-strong"&gt; object.&lt;/strong&gt; See &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;devDependencies&lt;/strong&gt;&lt;/code&gt;, below.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;See &lt;a href="https://docs.npmjs.com/misc/semver" class="markup--anchor markup--p-anchor" rel="noopener"&gt;semver&lt;/a&gt; for more details about specifying version ranges.&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;version&lt;/strong&gt;&lt;/code&gt; Must match &lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;version&lt;/strong&gt;&lt;/code&gt; exactly&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;&amp;gt;version&lt;/strong&gt;&lt;/code&gt; Must be greater than &lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;version&lt;/strong&gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;&amp;gt;=version&lt;/strong&gt;&lt;/code&gt; etc&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;&amp;lt;version&lt;/strong&gt;&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;&amp;lt;=version&lt;/strong&gt;&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;~version&lt;/strong&gt;&lt;/code&gt; “Approximately equivalent to version” See &lt;a href="https://docs.npmjs.com/misc/semver" class="markup--anchor markup--li-anchor" rel="noopener"&gt;semver&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;^version&lt;/strong&gt;&lt;/code&gt; “Compatible with version” See &lt;a href="https://docs.npmjs.com/misc/semver" class="markup--anchor markup--li-anchor" rel="noopener"&gt;semver&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;1.2.x&lt;/strong&gt;&lt;/code&gt; 1.2.0, 1.2.1, etc., but not 1.3.0&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;http://...&lt;/strong&gt;&lt;/code&gt; See ‘URLs as Dependencies’ below&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/code&gt; Matches any version&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;""&lt;/strong&gt;&lt;/code&gt; (just an empty string) Same as &lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;&lt;/strong&gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;version1 - version2&lt;/strong&gt;&lt;/code&gt; Same as &lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;&amp;gt;=version1 &amp;lt;=version2&lt;/strong&gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;range1 || range2&lt;/strong&gt;&lt;/code&gt; Passes if either range1 or range2 are satisfied.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;git...&lt;/strong&gt;&lt;/code&gt; See ‘Git URLs as Dependencies’ below&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;user/repo&lt;/strong&gt;&lt;/code&gt; See ‘GitHub URLs’ below&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;tag&lt;/strong&gt;&lt;/code&gt; A specific version tagged and published as &lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;tag&lt;/strong&gt;&lt;/code&gt; See &lt;code class="markup--code markup--li-code"&gt;&lt;a href="https://docs.npmjs.com/cli/dist-tag" class="markup--anchor markup--li-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;npm-dist-tag&lt;/strong&gt;&lt;/a&gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;path/path/path&lt;/strong&gt;&lt;/code&gt; See &lt;a href="https://docs.npmjs.com/files/package.json#local-paths" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Local Paths&lt;/a&gt; below&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="graf graf--pre graf-after--li"&gt;"dependencies": {&lt;br&gt;"&lt;a href="http://twitter.com/ionic/react" class="markup--anchor markup--pre-anchor" title="Twitter profile for @ionic/react"&gt;@ionic/react&lt;/a&gt;": "^4.8.0-rc.0",&lt;br&gt;"&lt;a href="http://twitter.com/ionic/react-router" class="markup--anchor markup--pre-anchor" title="Twitter profile for @ionic/react-router"&gt;@ionic/react-router&lt;/a&gt;": "^4.8.0-rc.0",&lt;br&gt;"&lt;a href="http://twitter.com/types/jest" class="markup--anchor markup--pre-anchor" title="Twitter profile for @types/jest"&gt;@types/jest&lt;/a&gt;": "24.0.11",&lt;br&gt;"&lt;a href="http://twitter.com/types/node" class="markup--anchor markup--pre-anchor" title="Twitter profile for @types/node"&gt;@types/node&lt;/a&gt;": "11.11.3",&lt;br&gt;"&lt;a href="http://twitter.com/types/react" class="markup--anchor markup--pre-anchor" title="Twitter profile for @types/react"&gt;@types/react&lt;/a&gt;": "^16.9.1",&lt;br&gt;"&lt;a href="http://twitter.com/types/react-dom" class="markup--anchor markup--pre-anchor" title="Twitter profile for @types/react-dom"&gt;@types/react-dom&lt;/a&gt;": "^16.8.5",&lt;br&gt;"&lt;a href="http://twitter.com/types/react-router" class="markup--anchor markup--pre-anchor" title="Twitter profile for @types/react-router"&gt;@types/react-router&lt;/a&gt;": "^5.0.3",&lt;br&gt;"&lt;a href="http://twitter.com/types/react-router-dom" class="markup--anchor markup--pre-anchor" title="Twitter profile for @types/react-router-dom"&gt;@types/react-router-dom&lt;/a&gt;": "^4.3.1",&lt;br&gt;"ionicons": "^4.6.2",&lt;br&gt;"react": "^16.9.0",&lt;br&gt;"react-dom": "^16.9.0",&lt;br&gt;"react-router": "^5.0.1",&lt;br&gt;"react-router-dom": "^5.0.1",&lt;br&gt;"react-scripts": "3.1.0",&lt;br&gt;"typescript": "3.5.3"&lt;br&gt;}&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;The next block scripts.&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;The “scripts” property is a dictionary containing script commands that are run at various times in the lifecycle of your package. The key is the lifecycle event, and the value is the command to run at that point.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;See &lt;code class="markup--code markup--p-code"&gt;&lt;a href="https://docs.npmjs.com/misc/scripts" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;npm-scripts&lt;/strong&gt;&lt;/a&gt;&lt;/code&gt; to find out more about writing package scripts.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;"scripts": {&lt;br&gt;"start": "react-scripts start",&lt;br&gt;"build": "react-scripts build",&lt;br&gt;"test": "react-scripts test",&lt;br&gt;"eject": "react-scripts eject"&lt;br&gt;},&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;Next block — &lt;code class="markup--code markup--h4-code"&gt;eslintConfig&lt;/code&gt;
&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;ESLint is designed to be completely configurable, meaning you can turn off every rule and run only with basic syntax validation, or mix and match the bundled rules and your custom rules to make ESLint perfect for your project. &lt;a href="http://eslint.org/docs/user-guide/configuring" class="markup--anchor markup--p-anchor" rel="noopener"&gt;There are two primary ways to configure ESLint&lt;/a&gt;&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Next block — Browserslist&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;The config to share target browsers and Node.js versions between different front-end tools. It is used in:&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;a href="https://github.com/postcss/autoprefixer" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener"&gt;Autoprefixer&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://github.com/babel/babel/tree/master/packages/babel-preset-env" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener"&gt;Babel&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://github.com/jonathantneal/postcss-preset-env" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener"&gt;postcss-preset-env&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://github.com/amilajack/eslint-plugin-compat" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener"&gt;eslint-plugin-compat&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://github.com/ismay/stylelint-no-unsupported-browser-features" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener"&gt;stylelint-no-unsupported-browser-features&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://github.com/jonathantneal/postcss-normalize" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener"&gt;postcss-normalize&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://github.com/ElemeFE/obsolete-webpack-plugin" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener"&gt;obsolete-webpack-plugin&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;All tools will find target browsers automatically when you add the following to &lt;code class="markup--code markup--p-code"&gt;package.json&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;"browserslist": [&lt;br&gt;"&amp;gt;0.2%",&lt;br&gt;"not dead",&lt;br&gt;"not ie &amp;lt;= 11",&lt;br&gt;"not op_mini all"&lt;br&gt;]&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;5. React in our Ionic app&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;We have already installed a plugin called &lt;code class="markup--code markup--p-code"&gt;&lt;a href="https://www.npmjs.com/package/%40ionic/react" class="markup--anchor markup--p-anchor" rel="noopener"&gt;@ionic/react&lt;/a&gt;&lt;/code&gt; which has all the dependency related to React Component in ionic.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;6. React dependencies what we are using in this starter&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;These plugins are already installed in this starter.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React router is required for navigation purpose.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;npm install react-router react-router-dom @types/react-router @types/react-router-dom&lt;/code&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;7. A look at a React Component&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;The base of our app will be in the &lt;code class="markup--code markup--p-code"&gt;src&lt;/code&gt; directory, and the main entry point will be our &lt;code class="markup--code markup--p-code"&gt;index.tsx&lt;/code&gt;. If we open our project in a code editor and open &lt;code class="markup--code markup--p-code"&gt;src/index.tsx&lt;/code&gt;, we should see the following:&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;So what’s going on here? Well, the first three lines are pulling in some dependencies.&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;The first being React itself. This allows us to write components in an HTML-like syntax called &lt;strong class="markup--strong markup--li-strong"&gt;JSX&lt;/strong&gt;. We’ll talk about JSX a bit more later on.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;The second import is for &lt;strong class="markup--strong markup--li-strong"&gt;ReactDOM&lt;/strong&gt;. The &lt;code class="markup--code markup--li-code"&gt;ReactDOM.render&lt;/code&gt; method is the browser/DOM specific way of taking our components and rendering it to a specified DOM node.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;The last import is the &lt;strong class="markup--strong markup--li-strong"&gt;root component&lt;/strong&gt; for our app, simply named &lt;code class="markup--code markup--li-code"&gt;App&lt;/code&gt;. This is our first React component and will be used in the bootstrapping process for our React app.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If we open &lt;code class="markup--code markup--p-code"&gt;App.tsx&lt;/code&gt;, we should see the following.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Let’s break it down too, starting with the first group of imports.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;pre class="graf graf--pre graf-after--figure"&gt;&lt;code class="markup--code markup--pre-code"&gt;import React from 'react';&lt;br&gt;import { Route } from 'react-router-dom';&lt;br&gt;import { IonApp, IonPage, IonRouterOutlet } from '@ionic/react';&lt;br&gt;import { IonReactRouter } from '@ionic/react-router';&lt;br&gt;import Home from './pages/Home';&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Similar to &lt;code class="markup--code markup--p-code"&gt;index.tsx&lt;/code&gt;, we first must import React in order to use JSX.&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;The next import is from &lt;code class="markup--code markup--li-code"&gt;react-router-dom&lt;/code&gt;. We're importing Route, which is how we’ll match the app’s URL with the components we want to render&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Following &lt;code class="markup--code markup--li-code"&gt;ReactRouter&lt;/code&gt;, we next have our first imports for Ionic. To use a component in React, you must first import it. So for Ionic, this means anytime we want to use a Button or a Card, it must be added to our imports. In the case of our App component, we’re only using &lt;code class="markup--code markup--li-code"&gt;IonApp&lt;/code&gt;, &lt;code class="markup--code markup--li-code"&gt;IonPage&lt;/code&gt;, &lt;code class="markup--code markup--li-code"&gt;IonRouterOutlet&lt;/code&gt;, and &lt;code class="markup--code markup--li-code"&gt;IonReactRouter&lt;/code&gt;.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;IonReactRouter is a component that wraps ReactRouter’s BrowserRouter component. It more or less behaves the same as BrowserRouter with a few differences. We have deeper guide that goes over these differences in our &lt;a href="https://ionicframework.com/docs/react/navigation" class="markup--anchor markup--li-anchor" rel="noopener"&gt;React Navigation Docs&lt;/a&gt;.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;The last important import is the &lt;code class="markup--code markup--li-code"&gt;Home&lt;/code&gt; component import. This is a component that we will be able to navigate to in our app. We'll look at the navigation part a bit later.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;The CSS import is pulling in the utility styles from Ionic for things like padding, typography, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;After reviewing all of the imports, we now get to our first look at a React Component:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;const App: React.FunctionComponent = () =&amp;gt; (&lt;br&gt;&amp;lt;IonApp&amp;gt;&lt;br&gt;&amp;lt;IonReactRouter&amp;gt;&lt;br&gt;&amp;lt;IonPage&amp;gt;&lt;br&gt;&amp;lt;IonRouterOutlet&amp;gt;&lt;br&gt;&amp;lt;Route path="/home" component={Home} exact={true} /&amp;gt;&lt;br&gt;&amp;lt;Route exact path="/" render={() =&amp;gt; &amp;lt;Redirect to="/home" /&amp;gt;} /&amp;gt;&lt;br&gt;&amp;lt;/IonRouterOutlet&amp;gt;&lt;br&gt;&amp;lt;/IonPage&amp;gt;&lt;br&gt;&amp;lt;/IonReactRouter&amp;gt;&lt;br&gt;&amp;lt;/IonApp&amp;gt;&lt;br&gt;);&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;This React component sets up the initial routing for our app, as well as include some core Ionic components for animations and layout (IonRouterOutlet and IonApp). One thing that stands out is that in React, to do data-binding, the value is passed in curly braces (&lt;code class="markup--code markup--p-code"&gt;{}&lt;/code&gt;). So in the &lt;code class="markup--code markup--p-code"&gt;Route&lt;/code&gt; component, we can set the value of &lt;code class="markup--code markup--p-code"&gt;component&lt;/code&gt; to the &lt;code class="markup--code markup--p-code"&gt;Home&lt;/code&gt; component from earlier. This is how React will know that that value is not a string, but a reference to a component.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;8. Modify Current React Component&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Now the &lt;code class="markup--code markup--p-code"&gt;App&lt;/code&gt; does not really have a lot to modify here. It's a basic example of a container component. With the Router logic set, all it's responsible for is to render a component that matches the given URL route. Since we already have one component/router setup, let's go ahead and modify our &lt;code class="markup--code markup--p-code"&gt;Home&lt;/code&gt; component.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Currently, the &lt;code class="markup--code markup--p-code"&gt;Home&lt;/code&gt; component looks like so:&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ncmTr02S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AjvDx_TUou5cSXdFyODUp0Q.jpeg"&gt;&lt;br&gt;Home Blank&lt;p class="graf graf--p graf-after--figure"&gt;For now, I am just creating a simple signup form with them of ionic/react component.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;So after editing your file something look like this&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;&lt;code class="markup--code markup--p-code"&gt;IonHeader&lt;/code&gt; is a bit self explanatory. It's a component that is meant to exist at the top of the page. &lt;code class="markup--code markup--p-code"&gt;IonHeader&lt;/code&gt; itself doesn't really do much by itself, aside from handling some &lt;a href="https://www.w3schools.com/css/css3_flexbox.asp" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;flexbox&lt;/strong&gt;&lt;/a&gt;-based layout. It's meant to hold other components, like &lt;code class="markup--code markup--p-code"&gt;IonToolbar&lt;/code&gt; or &lt;code class="markup--code markup--p-code"&gt;IonSearchbar&lt;/code&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;IonContent&lt;/code&gt; is, as its name suggests, the main content area for our page. It's responsible for providing the scrollable content that users will interact with, plus any scroll events that could be used in an app.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here in our &lt;code class="markup--code markup--p-code"&gt;IonContent&lt;/code&gt;, we're adding an &lt;code class="markup--code markup--p-code"&gt;IonList&lt;/code&gt; and a much more involved &lt;code class="markup--code markup--p-code"&gt;IonItem&lt;/code&gt;component. Let's look at &lt;code class="markup--code markup--p-code"&gt;IonItem&lt;/code&gt;, as it's really the centerpiece here.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&amp;lt;IonList no-lines&amp;gt;&lt;br&gt;&amp;lt;IonItem&amp;gt;&lt;br&gt;&amp;lt;IonLabel color="primary"&amp;gt;Username&amp;lt;/IonLabel&amp;gt;&lt;br&gt;&amp;lt;IonInput value={this.state.username} name="username" type="text" required&amp;gt;&lt;br&gt;&amp;lt;/IonInput&amp;gt;&lt;br&gt;&amp;lt;/IonItem&amp;gt;&lt;br&gt;&amp;lt;IonItem&amp;gt;&lt;br&gt;&amp;lt;IonLabel color="primary"&amp;gt;Password&amp;lt;/IonLabel&amp;gt;&lt;br&gt;&amp;lt;IonInput value={this.state.password} name="password" type="password" required&amp;gt;&lt;br&gt;&amp;lt;/IonInput&amp;gt;&lt;br&gt;&amp;lt;/IonItem&amp;gt;&lt;br&gt;&amp;lt;/IonList&amp;gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;And for input, we are using &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;IonInput&lt;/strong&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;and we have imported all this component from &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;@ionic/react&lt;/strong&gt;&lt;/code&gt; something like this&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import { IonHeader, IonToolbar, IonTitle, IonContent, IonList, IonItem, IonLabel, IonInput, IonButton } from '@ionic/react';&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;So after all this editing, our UI is something look like this:&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--J1ntBCDT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AHIwmx2F-BgbMguqNqFFRyQ.jpeg"&gt;&lt;br&gt;Simple SIgn up from&lt;h4 class="graf graf--h4 graf-after--figure"&gt;Creating a new Route&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Now that we have the pieces in place to navigate in our app, we need to create a new component and add the new route to our router declaration. Let’s open our &lt;code class="markup--code markup--p-code"&gt;App.tsx&lt;/code&gt; file and add the new route.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure is-selected"&gt;With our router now having an entry for the route &lt;code class="markup--code markup--p-code"&gt;/login&lt;/code&gt;, we'll create the component needed, &lt;code class="markup--code markup--p-code"&gt;Login&lt;/code&gt;. This will exist in &lt;code class="markup--code markup--p-code"&gt;src/pages/Login.tsx&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Let’s fill the &lt;code class="markup--code markup--p-code"&gt;Login.tsx&lt;/code&gt; with some placeholder content for the moment.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;The content here is pretty straight forward, and should look familiar to the &lt;code class="markup--code markup--p-code"&gt;Home&lt;/code&gt; component. What is new is the &lt;code class="markup--code markup--p-code"&gt;IonBackButton&lt;/code&gt; component. This is used to navigate back to the previous route. Pretty straight forward? Ok, but what if we reload the page?&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Well in this case, the in-memory history is lost, so the back button disappears. To address this, we can set the &lt;code class="markup--code markup--p-code"&gt;defaultHref&lt;/code&gt; attribute value to the URL we want to navigate to if there is no history.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;return (&lt;br&gt;  &amp;lt;&amp;gt;&lt;br&gt;    &amp;lt;IonHeader&amp;gt;&lt;br&gt;      &amp;lt;IonToolbar&amp;gt;&lt;br&gt;        &amp;lt;IonButtons slot="start"&amp;gt;&lt;br&gt;          &amp;lt;IonBackButton defaultHref="/home" /&amp;gt;&lt;br&gt;        &amp;lt;/IonButtons&amp;gt;&lt;br&gt;        &amp;lt;IonTitle&amp;gt;Log In&amp;lt;/IonTitle&amp;gt;&lt;br&gt;      &amp;lt;/IonToolbar&amp;gt;&lt;br&gt;    &amp;lt;/IonHeader&amp;gt;&lt;br&gt;    &amp;lt;IonContent /&amp;gt;&lt;br&gt;  &amp;lt;/&amp;gt;&lt;br&gt;);&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Here, when we reload, if there is no app history present, we’ll be able to navigate back to our home route.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What's Next?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that Ionic React RC is out, you can test it out and send the feedback to the developers. To report an issue or comment, head over to the &lt;a href="https://github.com/ionic-team/ionic/issues" class="markup--anchor markup--p-anchor" rel="noopener noreferrer noopener"&gt;GitHub repo&lt;/a&gt; and tag the issue with “package react”. You can also head over to the &lt;a href="https://forum.ionicframework.com/" class="markup--anchor markup--p-anchor" rel="noopener noreferrer noopener"&gt;forums&lt;/a&gt; to ask questions or start a discussion.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;For the Ionic Team, the focus is set on releasing Ionic React final “soon”. They are not expecting any of the APIs to have any more significant changes.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;We also plan on creating some more content and guides in the docs to help with some best practices we’ve found when working with Ionic React. We will soon upgrade our &lt;a href="https://store.enappd.com/product/ionic-react-full-app-capacitor/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Ionic-React Starter App&lt;/a&gt; from &lt;code class="markup--code markup--p-code"&gt;beta&lt;/code&gt; to RC (release-candidate)&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;To check how to create Ionic React app using Capacitor, check out my blog — &lt;/strong&gt;&lt;a href="https://enappd.com/blog/how-to-make-ionic-apps-in-react-using-capacitor/26/" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;How to make apps in Ionic using React and Capacitor&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;To read the full announcement, visit &lt;a href="https://blog.ionicframework.com/announcing-the-ionic-react-beta/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Ionic’s official website&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learnt how to start developing in Ionic-React RC, you can also try the following for Ionic Angular apps&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Ionic 4 Payment Gateways — &lt;a href="https://enappd.com/blog/ionic-4-stripe-payment-integration-with-firebase-for-apps-and-pwa/17" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe&lt;/a&gt; | &lt;a href="https://enappd.com/blog/ionic-4-paypal-payment-integration-for-apps-and-pwa/16" class="markup--anchor markup--li-anchor" rel="noopener"&gt;PayPal&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-integrate-apple-pay-in-ionic-4-apps/21" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-integrate-razorpay-in-ionic-4-apps-and-pwa/20" class="markup--anchor markup--li-anchor" rel="noopener"&gt;RazorPay&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Charts with — &lt;a href="https://enappd.com/blog/ionic-4-charts-using-google-charts/66" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Charts &lt;/a&gt;| &lt;a href="https://enappd.com/blog/adding-charts-in-ionic-4-apps-and-pwa-part-3/60" class="markup--anchor markup--li-anchor" rel="noopener"&gt;HighCharts&lt;/a&gt; | &lt;a href="https://enappd.com/blog/adding-charts-in-ionic-4-apps-and-pwa-part-2/54" class="markup--anchor markup--li-anchor" rel="noopener"&gt;d3.js&lt;/a&gt; | &lt;a href="https://enappd.com/blog/charts-in-ionic-4-apps-and-pwa-part-1/52" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Chart.js&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Social Logins — &lt;a href="https://enappd.com/blog/facebook-login-in-ionic-4-apps-using-firebase/25" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Facebook&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-login-in-ionic-4-apps-using-firebase/39" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-ionic-4-apps-using-firebase/24" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Authentications — &lt;a href="https://enappd.com/blog/email-authentication-with-firebase-in-ionic-4/38" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Via Email&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-anonymous-login-in-ionic-4/37" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Features — &lt;a href="https://enappd.com/blog/using-geolocation-geocoding-and-reverse-geocoding-in-ionic-4/45" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/qr-code-scanning-and-optical-character-recognition-ocr-in-ionic-4/9" class="markup--anchor markup--li-anchor" rel="noopener"&gt;QR Code reader &lt;/a&gt;| &lt;a href="https://enappd.com/blog/best-fitness-plugins-for-ionic-4-how-to-use-pedometer/15" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Pedometer&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Media in Ionic 4 — &lt;a href="https://enappd.com/blog/spotify-like-music-in-ionic-4-apps/48" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Audio&lt;/a&gt; | &lt;a href="https://enappd.com/blog/adding-video-player-in-ionic-4-app/64" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Video&lt;/a&gt; | &lt;a href="https://enappd.com/blog/image-picker-in-ionic-4-app/67" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-add-image-cropper-in-ionic-4-app/68" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image Cropper&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Essentials — &lt;a href="https://enappd.com/blog/ionic-4-save-and-retrieve-data-locally-on-device/59" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Native Storage&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-translate-in-ionic-4-globalization-internationalization-and-localization/11" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Translations&lt;/a&gt; | &lt;a href="https://enappd.com/blog/rtl-right-to-left-use-in-ionic-4/50" class="markup--anchor markup--li-anchor" rel="noopener"&gt;RTL&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 messaging — &lt;a href="https://enappd.com/blog/implement-ionic-4-firebase-push/34" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Firebase Push&lt;/a&gt; | &lt;a href="https://enappd.com/blog/automatically-read-sms-in-ionic-4-apps/42" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Reading SMS&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 with Firebase — &lt;a href="https://enappd.com/blog/how-to-integrate-firebase-in-ionic-4-apps/23" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Basics&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-with-ionic-4-hosting-auth-and-db-connection/58" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Hosting and DB&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-cloud-functions-in-ionic-4-complete-guide/32" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Cloud functions&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next Ionic 4 app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/ionic-4-full-app" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Ionic 4 Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--IFbNjPgI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A2BzL8TesnBHuazHr3VA4SQ.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>ionic</category>
      <category>capacitor</category>
    </item>
    <item>
      <title>How to use Geolocation, Geocoding and Reverse Geocoding in React Native Apps</title>
      <dc:creator>Umang Darji</dc:creator>
      <pubDate>Fri, 27 Mar 2020 00:23:11 +0000</pubDate>
      <link>https://forem.com/enappd/how-to-use-geolocation-geocoding-and-reverse-geocoding-in-react-native-apps-59go</link>
      <guid>https://forem.com/enappd/how-to-use-geolocation-geocoding-and-reverse-geocoding-in-react-native-apps-59go</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;In this post, you will learn how to implement Geolocation React native apps. We will also learn how to Convert Geocode in Location address (Reverse Geocoding) and Location Address into Geocode(Geocoding) in a simple React native app.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native lets you build mobile apps using only JavaScript. It uses the same design as React, letting you compose a rich mobile UI using declarative components.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What Is React Native?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3 is-selected"&gt;React Native is a JavaScript framework for writing real, natively rendering mobile applications for iOS and Android. It’s based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. In other words: web developers can now write mobile applications that look and feel truly “native,” all from the comfort of a JavaScript library that we already know and love. Plus, because most of the code you write can be shared between platforms, React Native makes it easy to simultaneously develop for both Android and iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Similar to React for the Web, React Native applications are written using a mixture of JavaScript and XML markup, known as JSX. Then, under the hood, the React Native “bridge” invokes the native rendering APIs in Objective-C (for iOS) or Java (for Android). Thus, your application will render using real mobile UI components, not webviews, and will look and feel like any other mobile application. React Native also exposes JavaScript interfaces for platform APIs, so your React Native apps can access platform features like the phone camera, or the user’s location.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native currently supports both iOS and Android and has the potential to expand to future platforms as well. In this blog, we’ll cover both iOS and Android. The vast majority of the code we write will be cross-platform. And yes: you can really use React Native to build production-ready mobile applications! Some example: &lt;a href="http://bit.ly/1YipO7A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Facebook&lt;/a&gt;, &lt;a href="http://bit.ly/1PPEiZH" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Palantir&lt;/a&gt;, and &lt;a href="http://bit.ly/1PPEjNg" class="markup--anchor markup--p-anchor" rel="noopener"&gt;TaskRabbit&lt;/a&gt; are already using it in production for user-facing applications.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is Geolocation?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;The most famous and familiar location feature — Geolocation is the ability to track a device’s whereabouts using GPS, cell phone towers, WiFi access points or a combination of these. Since devices are used by individuals, geolocation uses positioning systems to track an individual’s whereabouts down to latitude and longitude coordinates, or more practically, a physical address. Both mobile and desktop devices can use geolocation.&lt;br&gt;Geolocation can be used to determine time zone and exact positioning coordinates, such as for tracking wildlife or cargo shipments.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Some famous apps using Geolocation are&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Uber / Lyft — Cab booking&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Google Maps (of course) — Map services&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Swiggy / Zomato — Food delivery&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Fitbit — Fitness app&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Instagram / Facebook — For tagging photos&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;What is Geocoding and Reverse geocoding?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Geocoding&lt;/strong&gt; is the process of transforming a street address or other description of a location into a (latitude, longitude) coordinate.&lt;br&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Reverse geocoding&lt;/strong&gt; is the process of transforming a (latitude, longitude) coordinate into a (partial) address. The amount of detail in a reverse geocoded location description may vary, for example, one might contain the full street address of the closest building, while another might contain only a city name and postal code.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Post structure&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;We will go in a step-by-step manner to explore the anonymous login feature of Firebase. This is my break-down of the blog&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;STEPS&lt;/strong&gt;&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Create a simple React Native app&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Install Plugins for Geocoding and Geolocation and get User Location&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Get User Current Location (Geocoding)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Convert User Geolocation into an address (Reverse Geocoding)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Convert User Entered Address into Geocode (Geocoding)&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;We have three major objectives&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Get User Current Location which we will get in latitude and longitude (Geolocation)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Convert that latitude and longitude in Street Address (Reverse Geocoding)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;And again convert Street address entered by the user into latitude and longitude (Geocoding)&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Let’s dive right in!&lt;/strong&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 1: — Create a simple React Native app&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;If you are coming from a web background, the easiest way to get started with React Native is with Expo tools because they allow you to start a project without installing and configuring Xcode or Android Studio. Expo CLI sets up a development environment on your local machine and you can begin writing a React Native app within minutes. For instant development, you can use &lt;a href="https://snack.expo.io/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Snack&lt;/a&gt; to try React Native out directly in your web browser.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;If you are familiar with native development, you will likely want to use React Native CLI. It requires Xcode or Android Studio to get started. If you already have one of these tools installed, you should be able to get up and running within a few minutes. If they are not installed, you should expect to spend about an hour installing and configuring them.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Expo CLI Quickstart&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Assuming that you have &lt;a href="https://nodejs.org/en/download/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Node 10+&lt;/a&gt; installed, you can use npm to install the Expo CLI command-line utility:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;npm install -g expo-cli&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Then run the following commands to create a new React Native project called “AwesomeProject”:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;expo init AwesomeProject&lt;br&gt;cd AwesomeProject&lt;br&gt;npm start # you can also use: expo start&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;This will start a development server for you.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;React Native CLI Quickstart&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Assuming that you have &lt;a href="https://nodejs.org/en/download/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Node 10+&lt;/a&gt; installed, you can use npm to install the React Native CLI command-line utility:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;npm install -g react-native-cli&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Then run the following commands to create a new React Native project called “AwesomeProject”:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;react-native init AwesomeProject&lt;/pre&gt;
&lt;blockquote class="graf graf--blockquote graf-after--pre"&gt;For details you can check this &lt;a href="https://facebook.github.io/react-native/docs/getting-started.html" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;link&lt;/a&gt;.&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Step 2 : — Install Plugins for Geocoding and Geolocation and get User Location&lt;/h3&gt;
&lt;blockquote class="graf graf--blockquote graf-after--h3"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;In Bare React Native Apps&lt;/strong&gt;&lt;/blockquote&gt;
&lt;h4 class="graf graf--h4 graf-after--blockquote"&gt;react-native-geolocation-service&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;This library is created in an attempt to fix the location timeout issue on android with the react-native’s current implementation of Geolocation API. This library tries to solve the issue by using Google Play Service’s new &lt;code class="markup--code markup--p-code"&gt;FusedLocationProviderClient&lt;/code&gt; API, which Google strongly recommends over android's default framework location API. It automatically decides which provider to use based on your request configuration and also prompts you to change the location mode if it doesn't satisfy your current request configuration.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;em class="markup--em markup--blockquote-em"&gt;NOTE: Location request can still timeout since many android devices have GPS issue in the hardware level or in the system software level. Check the &lt;/em&gt;&lt;a href="https://github.com/Agontuk/react-native-geolocation-service#faq" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;FAQ&lt;/em&gt;&lt;/a&gt;&lt;em class="markup--em markup--blockquote-em"&gt; for more details.&lt;/em&gt;
&lt;/blockquote&gt;
&lt;h4 class="graf graf--h4 graf-after--blockquote"&gt;Installation&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;yarn&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;yarn add react-native-geolocation-service&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;npm&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;npm install react-native-geolocation-service&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;Setup&lt;/h4&gt;
&lt;h4 class="graf graf--h4 graf-after--h4"&gt;Android&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;No additional setup is required for Android&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;iOS&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;You need to include the &lt;code class="markup--code markup--p-code"&gt;NSLocationWhenInUseUsageDescription&lt;/code&gt; key in Info.plist to enable geolocation when using the app. In order to enable geolocation in the background, you need to include the &lt;code class="markup--code markup--p-code"&gt;NSLocationAlwaysUsageDescription&lt;/code&gt; key in Info.plist and add location as a background mode in the 'Capabilities' tab in Xcode.&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;Update your &lt;code class="markup--code markup--li-code"&gt;Podfile&lt;/code&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;pre class="graf graf--pre graf-after--li"&gt;&lt;code class="markup--code markup--pre-code"&gt;pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation'&lt;/code&gt;&lt;/pre&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--pre"&gt;Then run &lt;code class="markup--code markup--li-code"&gt;pod install&lt;/code&gt; from ios directory&lt;/li&gt;&lt;/ul&gt;
&lt;blockquote class="graf graf--blockquote graf-after--li"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;In EXPO &lt;/strong&gt;&lt;a href="https://docs.expo.io/versions/latest/introduction/managed-vs-bare/#managed-workflow" class="markup--anchor markup--blockquote-anchor" rel="noopener noreferrer noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;managed&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt; apps,&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;you’ll need to run&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;expo install expo-location&lt;/code&gt;&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;Step 3: — Get User Current Location (Geocoding)&lt;/h3&gt;
&lt;blockquote class="graf graf--blockquote graf-after--h3"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;In Bare React Native Apps,&lt;/strong&gt;&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Since this library was meant to be a drop-in replacement for the RN’s Geolocation API, the usage is pretty straight forward, with some extra error cases to handle.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;One thing to note, this library assumes that location permission is already granted by the user, so you have to use &lt;code class="markup--code markup--blockquote-code"&gt;PermissionsAndroid&lt;/code&gt; to request for permission before making the location request.&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;For getting user location you have to import &lt;code class="markup--code markup--p-code"&gt;Geolocation&lt;/code&gt; API from &lt;code class="markup--code markup--p-code"&gt;react-native-geolocation-service&lt;/code&gt; package like this&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import Geolocation from 'react-native-geolocation-service';&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;And add this function into your code&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;if (hasLocationPermission) {&lt;br&gt;        Geolocation.getCurrentPosition(&lt;br&gt;            (position) =&amp;gt; {&lt;br&gt;                console.log(position);&lt;br&gt;            },&lt;br&gt;            (error) =&amp;gt; {&lt;br&gt;                // See error code charts below.&lt;br&gt;                console.log(error.code, error.message);&lt;br&gt;            },&lt;br&gt;            { enableHighAccuracy: true, timeout: 15000, maximumAge:          10000 }&lt;br&gt;        );&lt;br&gt;    }&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;So after adding all this code your file something look like this.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;blockquote class="graf graf--blockquote graf-after--figure"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;In EXPO &lt;/strong&gt;&lt;a href="https://docs.expo.io/versions/latest/introduction/managed-vs-bare/#managed-workflow" class="markup--anchor markup--blockquote-anchor" rel="noopener noreferrer noopener noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;managed&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt; apps,&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;For getting user location you have to import &lt;code class="markup--code markup--p-code"&gt;Location &lt;/code&gt;API from &lt;code class="markup--code markup--p-code"&gt;expo-location&lt;/code&gt; package like this&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;import * as Location from 'expo-location';&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;And add this function into your code&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;_getLocationAsync = async () =&amp;gt; {&lt;br&gt;    let { status } = await Permissions.askAsync(Permissions.LOCATION);&lt;br&gt;    if (status !== 'granted') {&lt;br&gt;      this.setState({&lt;br&gt;        errorMessage: 'Permission to access location was denied',&lt;br&gt;      });&lt;br&gt;    }&lt;br&gt;let location = await Location.getCurrentPositionAsync({});&lt;br&gt;    this.setState({ location });&lt;br&gt;  };&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;So after adding all this code your file something look like this.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;One thing to note, this library assumes that location permission is already granted by the user, so you have to use &lt;code class="markup--code markup--blockquote-code"&gt;Permissions from ‘expo-permissions’&lt;/code&gt; to request for permission before making the location request.&lt;/blockquote&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 4: — Convert User Geolocation into an address (Reverse Geocoding)&lt;/h3&gt;
&lt;blockquote class="graf graf--blockquote graf-after--h3"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;In Bare React Native Apps,&lt;/strong&gt;&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;In this app, we are using &lt;code class="markup--code markup--p-code"&gt;react-native-geocoding&lt;/code&gt; package for &lt;strong class="markup--strong markup--p-strong"&gt;Geocoding&lt;/strong&gt; and &lt;strong class="markup--strong markup--p-strong"&gt;Reverse Geocoding&lt;/strong&gt;&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;react-native-geocoding&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;A geocoding module for &lt;a href="https://github.com/facebook/react-native" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native&lt;/a&gt; to transform a description of a location (i.e. street address, town name, etc.) into geographic coordinates (i.e. latitude and longitude) and vice versa.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;This module uses the &lt;a href="https://developers.google.com/maps/documentation/geocoding/intro" class="markup--anchor markup--p-anchor" rel="nofollow noopener"&gt;Google Maps Geocoding API&lt;/a&gt; and requires an API key for purposes of quota management. Please check &lt;a href="https://developers.google.com/maps/documentation/geocoding/get-api-key" class="markup--anchor markup--p-anchor" rel="nofollow noopener"&gt;this link&lt;/a&gt; out to obtain your API key.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Install&lt;/h4&gt;
&lt;pre class="graf graf--pre graf-after--h4"&gt;npm install --save react-native-geocoding&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;For Geocoding and Reverse Geocoding in your app you import &lt;code class="markup--code markup--p-code"&gt;Geocoder&lt;/code&gt; API from &lt;code class="markup--code markup--p-code"&gt;react-native-geocoding&lt;/code&gt; package like this&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import Geocoder from 'react-native-geocoding';&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;And Then you have to initialize the module in your app(needs to be done only once)&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Geocoder.init("xxxxxxxxxxxxxxxxxxxxxxxxx"); // use a valid API key&lt;br&gt;// With more options&lt;br&gt;// Geocoder.init("xxxxxxxxxxxxxxxxxxxxxxxxx", {language : "en"}); // set the language&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;And use this code respectively for Geocoding and reverse Geocoding&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Geocoder.from(41.89, 12.49)&lt;br&gt;       .then(json =&amp;gt; {&lt;br&gt;              var addressComponent = json.results[0].address_components[0];&lt;br&gt;           console.log(addressComponent);&lt;br&gt;      })&lt;br&gt;      .catch(error =&amp;gt; console.warn(error));&lt;br&gt;// Works as well :&lt;br&gt;// ------------&lt;br&gt;// location object&lt;br&gt;Geocoder.from({&lt;br&gt;  latitude : 41.89,&lt;br&gt;   longitude : 12.49&lt;br&gt;});&lt;br&gt;// latlng object&lt;br&gt;Geocoder.from({&lt;br&gt; lat : 41.89,&lt;br&gt;    lng : 12.49&lt;br&gt;});&lt;br&gt;// array&lt;br&gt;Geocoder.from([41.89, 12.49]);&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;Error Codes&lt;/h4&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;blockquote class="graf graf--blockquote graf-after--figure"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;In EXPO &lt;/strong&gt;&lt;a href="https://docs.expo.io/versions/latest/introduction/managed-vs-bare/#managed-workflow" class="markup--anchor markup--blockquote-anchor" rel="noopener noreferrer noopener noopener noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;managed&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt; apps,&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;For geocoding of Address we are using &lt;code class="markup--code markup--p-code"&gt;react-native-geocoding&lt;/code&gt; so the installation and Initialize Steps are the same as Geolocation.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;we will use this code for Reverse Geocoding&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;_attemptReverseGeocodeAsync = async () =&amp;gt; {&lt;br&gt;    this.setState({ inProgress: true });&lt;br&gt;    try {&lt;br&gt;      let result = await Location.reverseGeocodeAsync(&lt;br&gt;        this.state.selectedExample&lt;br&gt;      );&lt;br&gt;      this.setState({ result });&lt;br&gt;    } catch (e) {&lt;br&gt;      this.setState({ error: e });&lt;br&gt;    } finally {&lt;br&gt;      this.setState({ inProgress: false });&lt;br&gt;    }&lt;br&gt;  };&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;Step 5: — Convert User Entered Address into Geocode (Geocoding)&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;For Reverse geocoding of Address, we are using &lt;code class="markup--code markup--p-code"&gt;expo-location&lt;/code&gt; so the installation and Initialize Steps are the same as Reverse Geocoding.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;we will use this code for Geocoding&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Geocoder.from("Colosseum")&lt;br&gt;      .then(json =&amp;gt; {&lt;br&gt;          var location = json.results[0].geometry.location;&lt;br&gt;           console.log(location);&lt;br&gt;      })&lt;br&gt;      .catch(error =&amp;gt; console.warn(error));&lt;/pre&gt;
&lt;blockquote class="graf graf--blockquote graf-after--pre"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;In EXPO &lt;/strong&gt;&lt;a href="https://docs.expo.io/versions/latest/introduction/managed-vs-bare/#managed-workflow" class="markup--anchor markup--blockquote-anchor" rel="noopener noreferrer noopener noopener noopener noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;managed&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt; apps,&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;For geocoding of Address we are using &lt;code class="markup--code markup--p-code"&gt;react-native-geocoding&lt;/code&gt; so the installation and Initialize Steps are the same as Geolocation.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;we will use this code for Geocoding&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;_attemptGeocodeAsync = async () =&amp;gt; {&lt;br&gt;    this.setState({ inProgress: true, error: null });&lt;br&gt;    try {&lt;br&gt;      let result = await Location.geocodeAsync(this.state.selectedExample);&lt;br&gt;      this.setState({ result });&lt;br&gt;    } catch (e) {&lt;br&gt;      this.setState({ error: e.message });&lt;br&gt;    } finally {&lt;br&gt;      this.setState({ inProgress: false });&lt;br&gt;    }&lt;br&gt;  };&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Working Example of Geocode and Reverse Geocing in Your App&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3 graf--trailing"&gt;In this blog, we learned how to implement Geolocation React Native app. We also learnt how to Convert Geocode in Location address(Reverse Geocoding) and Location Address into Geocode(Geocoding) in a simple React Native app.&lt;/p&gt;

&lt;h3 class="graf graf--h3 graf--leading"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learnt about how to implement Geolocation , Geocoding and Reverse Geocoding React Native app, here are some other topics you can look into&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener"&gt;React Native life cycle hooks&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To in React Native — &lt;a href="https://enappd.com/blog/pick-images-from-camera-gallery-in-react-native-app/78" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image picker&lt;/a&gt;| &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Integrate Firebase&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/guide-on-react-native-full-app/53" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/firebase-push-notifications-in-react-native/81/" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Firebase Push notifications in React Native Apps&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next React Native app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/react-native-full-app/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZXPQrtfu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AsWyEeAfCMk7ULOkLUCdSug.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>geolocation</category>
      <category>geocoding</category>
    </item>
    <item>
      <title>AndroidX Support in React Native Apps</title>
      <dc:creator>Umang Darji</dc:creator>
      <pubDate>Fri, 27 Mar 2020 00:12:11 +0000</pubDate>
      <link>https://forem.com/enappd/androidx-support-in-react-native-apps-d8f</link>
      <guid>https://forem.com/enappd/androidx-support-in-react-native-apps-d8f</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;In this post we’ll look into What is Android X and its support in React Native.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native lets you build mobile apps using only JavaScript. It uses the same design as React, letting you compose a rich mobile UI using declarative components.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What Is React Native?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;React Native is a JavaScript framework for writing real, natively rendering mobile applications for iOS and Android. It’s based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. In other words: web developers can now write mobile applications that look and feel truly “native,” all from the comfort of a JavaScript library that we already know and love. Plus, because most of the code you write can be shared between platforms, React Native makes it easy to simultaneously develop for both Android and iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Similar to React for the Web, React Native applications are written using a mixture of JavaScript and XML markup, known as JSX. Then, under the hood, the React Native “bridge” invokes the native rendering APIs in Objective-C (for iOS) or Java (for Android). Thus, your application will render using real mobile UI components, not webviews, and will look and feel like any other mobile application. React Native also exposes JavaScript interfaces for platform APIs, so your React Native apps can access platform features like the phone camera, or the user’s location.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native currently supports both iOS and Android and has the potential to expand to future platforms as well. In this blog, we’ll cover both iOS and Android. The vast majority of the code we write will be cross-platform. And yes: you can really use React Native to build production-ready mobile applications! Some example: &lt;a href="http://bit.ly/1YipO7A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Facebook&lt;/a&gt;, &lt;a href="http://bit.ly/1PPEiZH" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Palantir&lt;/a&gt;, and &lt;a href="http://bit.ly/1PPEjNg" class="markup--anchor markup--p-anchor" rel="noopener"&gt;TaskRabbit&lt;/a&gt; are already using it in production for user-facing applications.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;AndroidX Overview&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;If you haven’t heard the term yet, &lt;a href="https://developer.android.com/jetpack/androidx" class="markup--anchor markup--p-anchor" rel="noopener"&gt;AndroidX&lt;/a&gt; is the new open-source project being rolled out by Google to package libraries with Jetpack. Essentially, the old way of managing libraries was becoming overcomplicated and so Google decided to start cleaning up their act and use a new system, along with new library names.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;AndroidX is a major improvement to the original Android &lt;a href="https://developer.android.com/topic/libraries/support-library/index" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Support Library&lt;/a&gt;. Like the Support Library, AndroidX ships separately from the Android OS and provides backwards-compatibility across Android releases. AndroidX fully replaces the Support Library by providing feature parity and new libraries. In addition AndroidX includes the following features:&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;All packages in AndroidX live in a consistent namespace starting with the string &lt;code class="markup--code markup--li-code"&gt;androidx&lt;/code&gt;. The Support Library packages have been mapped into corresponding &lt;code class="markup--code markup--li-code"&gt;androidx.*&lt;/code&gt; packages. For a full mapping of all the old classes and build artifacts to the new ones, see the &lt;a href="https://developer.android.com/jetpack/androidx/refactor" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Package Refactoring&lt;/a&gt; page.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Unlike the Support Library, AndroidX packages are separately maintained and updated. The &lt;code class="markup--code markup--li-code"&gt;androidx&lt;/code&gt; packages use strict &lt;a href="https://semver.org/" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Semantic Versioning&lt;/a&gt; starting with version 1.0.0. You can update AndroidX libraries in your project independently.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;All new Support Library development will occur in the AndroidX library. This includes maintenance of the original Support Library artifacts and introduction of new Jetpack components.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;Using AndroidX&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;If you want to use AndroidX in a new project, you need to set the compile SDK to Android 9.0 (API level 28) or higher and set both of the following Android Gradle plugin flags to &lt;code class="markup--code markup--p-code"&gt;true&lt;/code&gt; in your &lt;code class="markup--code markup--p-code"&gt;&lt;a href="https://developer.android.com/studio/build/#properties-files" class="markup--anchor markup--p-anchor" rel="noopener"&gt;gradle.properties&lt;/a&gt;&lt;/code&gt;&lt;a href="https://developer.android.com/studio/build/#properties-files" class="markup--anchor markup--p-anchor" rel="noopener"&gt; file&lt;/a&gt;.&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;
&lt;code class="markup--code markup--li-code"&gt;android.useAndroidX&lt;/code&gt;: When set to &lt;code class="markup--code markup--li-code"&gt;true&lt;/code&gt;, the Android plugin uses the appropriate AndroidX library instead of a Support Library. The flag is &lt;code class="markup--code markup--li-code"&gt;false&lt;/code&gt; by default if it is not specified.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;android.enableJetifier&lt;/code&gt;: When set to &lt;code class="markup--code markup--li-code"&gt;true&lt;/code&gt;, the Android plugin automatically migrates existing third-party libraries to use AndroidX by rewriting their binaries. The flag is &lt;code class="markup--code markup--li-code"&gt;false&lt;/code&gt; by default if it is not specified.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;code class="markup--code markup--p-code"&gt;&lt;a href="https://developer.android.com/studio/build/#properties-files" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;gradle.properties&lt;/strong&gt;&lt;/a&gt;&lt;/code&gt;&lt;a href="https://developer.android.com/studio/build/#properties-files" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt; file&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--p-strong"&gt;-:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;android.useAndroidX=true&lt;br&gt;android.enableJetifier=true&lt;/code&gt;&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;How to Migrate Android Support Packages into AndroidX in React Native ≥0.59&lt;/h3&gt;
&lt;h3 class="graf graf--h3 graf-after--h3"&gt;Step 1&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;First of all, I opened &lt;code class="markup--code markup--p-code"&gt;&lt;em class="markup--em markup--p-em"&gt;MyProject/Android/build.gradle&lt;/em&gt;&lt;/code&gt; and verified I am targeting Android Pie or later. It’s because AndroidX support is available for apps targeting API 28 or later. My &lt;code class="markup--code markup--p-code"&gt;build.gradle&lt;/code&gt; file was as given below:&lt;/p&gt;##iframe0##&lt;h3 class="graf graf--h3 graf-after--figure is-selected"&gt;Step 2&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Then I opened &lt;code class="markup--code markup--p-code"&gt;&lt;em class="markup--em markup--p-em"&gt;MyProject/Android/gradle.properties&lt;/em&gt;&lt;/code&gt; and added the following lines&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;android.useAndroidX=true&lt;br&gt;android.enableJetifier=true&lt;/code&gt;&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;Step 3&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;If you use React Native modules with native Java code that isn’t converted to AndroidX, and your app is AndroidX, you probably need &lt;a href="https://www.npmjs.com/package/jetifier" class="markup--anchor markup--p-anchor" rel="noopener"&gt;jetifier&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;The jetifier is an AndroidX transition tool in npm format, with a react-native compatible style&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Why do you need Jetifier?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;The &lt;a href="https://developer.android.com/jetpack/androidx/migrate" class="markup--anchor markup--p-anchor" rel="nofollow noopener"&gt;standard AndroidX migration&lt;/a&gt; rewrites your &lt;strong class="markup--strong markup--p-strong"&gt;current&lt;/strong&gt; installed source code, and at build time dynamically re-writes any linked jar/aar/zip files. This is all a “normal” Android app needs.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native apps are not standard Android apps. React Native modules with native Java code usually distribute that code as source, and link the source code directly.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;When you update your modules (or install them again after following the standard AndroidX migration), the freshly installed Java code from your react-native dependencies will not be translated to AndroidX anymore, and your build will fail.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;So you have to perform an AndroidX migration on your linked source every time you update react-native modules that ship native Java code. That is what this tool does.it can rewrite the source in node_modules every time you call it.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Usage for source files&lt;/h3&gt;
&lt;h4 class="graf graf--h4 graf-after--h3"&gt;To jetify / convert node_modules dependencies to AndroidX&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Imagine you have a react-native project. &lt;a href="https://developers.google.com/android/guides/releases#june_17_2019" class="markup--anchor markup--p-anchor" rel="nofollow noopener"&gt;One of your library dependencies converts to AndroidX.&lt;/a&gt;, and you need to use the new version.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;So now you need to convert your app to AndroidX, but many of your react-native libraries ship native Java code and have not updated. How is this done?&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;First, use Android Studio’s refactoring tool to convert your app re: the &lt;a href="https://developer.android.com/jetpack/androidx/migrate" class="markup--anchor markup--li-anchor" rel="nofollow noopener"&gt;Android developer docs&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;npm install --save-dev jetifier&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;code class="markup--code markup--li-code"&gt;npx jetify&lt;/code&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;npx react-native run-android&lt;/code&gt; (your app should correctly compile and work)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Call &lt;code class="markup--code markup--li-code"&gt;npx jetify&lt;/code&gt; run in the postinstall target of your package.json (Any time your dependencies update you have to jetify again)&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;Proof it works / how this is tested: &lt;a href="https://github.com/mikehardy/rn-androidx-demo" class="markup--anchor markup--p-anchor" rel="nofollow noopener"&gt;&lt;/a&gt;&lt;a href="https://github.com/mikehardy/rn-androidx-demo"&gt;https://github.com/mikehardy/rn-androidx-demo&lt;/a&gt;. You can clone that repo, run the script, and see it works. Please feel to make PRs to that repo, especially in App.js or in the dependencies included, if you would like to demonstrate success or failure for a specific module.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;em class="markup--em markup--p-em"&gt;Inspiration:&lt;/em&gt; this jetify command was based on &lt;a href="https://gist.github.com/janicduplessis/df9b5e3c2b2e23bbae713255bdb99f3c" class="markup--anchor markup--p-anchor" rel="nofollow noopener"&gt;an idea&lt;/a&gt; from @janicduplessis — thank you Janic!&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;To reverse-jetify / convert node_modules dependencies to Support Libraries&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Maybe you are in the position where you must not migrate to AndroidX yet. But your libraries have started to migrate and they ship AndroidX native Java code.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;You can convert them back with reverse-jetify mode&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Follow the instructions from above to convert to AndroidX, &lt;strong class="markup--strong markup--p-strong"&gt;but add the &lt;/strong&gt;&lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;-r&lt;/strong&gt;&lt;/code&gt;&lt;strong class="markup--strong markup--p-strong"&gt; flag to the &lt;/strong&gt;&lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;npx jetify&lt;/strong&gt;&lt;/code&gt;&lt;strong class="markup--strong markup--p-strong"&gt; call.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;If a library ships only as a jar/aar/zip file, you will have to use jetifier-standalone to convert that as well, but you can delay the AndroidX migration indefinitely with this style.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Usage for jar/zip/aar files&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;You may be a library maintainer, wanting to ship an AAR of your support code converted to AndroidX, or maybe you ship an AAR normally and you want to continue to support your non-AndroidX users even after you convert your library to AndroidX?&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;As part of your build process you can use this tool like so:&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;
&lt;code class="markup--code markup--li-code"&gt;npm install jetifier&lt;/code&gt; (or maybe &lt;code class="markup--code markup--li-code"&gt;npm install -g jetifier&lt;/code&gt; to make it globally available)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;npx jetifier-standalone &amp;lt;your arguments here&amp;gt;&lt;/code&gt; (use &lt;code class="markup--code markup--li-code"&gt;npx jetifier-standalone -h&lt;/code&gt; for help)&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this post, we learnt about “What is Android X”, and how to Migrate Android Support Packages into AndroidX in React Native ≥0.59. We also learn about what is jetifier.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learnt about How to Migrate Android Support Packages into AndroidX in React Native ≥0.59, here are some other topics you can look into&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener"&gt;React Native life cycle hooks&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To in React Native — &lt;a href="https://enappd.com/blog/pick-images-from-camera-gallery-in-react-native-app/78" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image picker&lt;/a&gt;| &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Integrate Firebase&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/guide-on-react-native-full-app/53" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next React Native app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/react-native-full-app/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--wxKO7G0G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2AsWyEeAfCMk7ULOkLUCdSug.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>androidx</category>
      <category>android</category>
      <category>jetifier</category>
    </item>
    <item>
      <title>A guide to React Native life cycle hooks</title>
      <dc:creator>Umang Darji</dc:creator>
      <pubDate>Thu, 26 Mar 2020 18:04:26 +0000</pubDate>
      <link>https://forem.com/enappd/a-guide-to-react-native-life-cycle-hooks-2jje</link>
      <guid>https://forem.com/enappd/a-guide-to-react-native-life-cycle-hooks-2jje</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;React Native lets you build mobile apps using only JavaScript. It uses the same design as React, letting you compose a rich mobile UI using declarative components.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;React Native is a JavaScript framework for writing real, natively rendering mobile applications for iOS and Android. It’s based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. In other words: web developers can now write mobile applications that look and feel truly “native,” all from the comfort of a JavaScript library that we already know and love. Plus, because most of the code you write can be shared between platforms, React Native makes it easy to simultaneously develop for both Android and iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Similar to React for the Web, React Native applications are written using a mixture of JavaScript and XML markup, known as JSX. Then, under the hood, the React Native “bridge” invokes the native rendering APIs in Objective-C (for iOS) or Java (for Android). Thus, your application will render using real mobile UI components, not webviews, and will look and feel like any other mobile application. React Native also exposes JavaScript interfaces for platform APIs, so your React Native apps can access platform features like the phone camera, or the user’s location.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native currently supports both iOS and Android and has the potential to expand to future platforms as well. In this blog, we’ll cover both iOS and Android. The vast majority of the code we write will be cross-platform. And yes: you can really use React Native to build production-ready mobile applications! Some example: &lt;a href="http://bit.ly/1YipO7A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Facebook&lt;/a&gt;, &lt;a href="http://bit.ly/1PPEiZH" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Palantir&lt;/a&gt;, and &lt;a href="http://bit.ly/1PPEjNg" class="markup--anchor markup--p-anchor" rel="noopener"&gt;TaskRabbit&lt;/a&gt; are already using it in production for user-facing applications.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;When developing in React Native, every Component follows a cycle from when it’s created and mounted on the DOM to when it is unmounted and destroyed. This is what we refer to as the Component lifecycle.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native provides hooks, methods that get called automatically at each point in the lifecycle, that give you good control of what happens at the point it is invoked. A good understanding of these hooks will give you the power to effectively control and manipulate what goes on in a component throughout its lifetime.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Our lifecycle is broadly categorized into three parts: &lt;em class="markup--em markup--p-em"&gt;Mounting&lt;/em&gt;, &lt;em class="markup--em markup--p-em"&gt;Updating&lt;/em&gt; and &lt;em class="markup--em markup--p-em"&gt;Unmounting&lt;/em&gt;.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--O0inyL9S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2AXJBsrYIgT8Bu4SFUZowDgA.jpeg"&gt;&lt;br&gt;New Lifecycle Hooks&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Component cycles&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;There are multiple reasons a component might re-render, and in each of them different functions are called allowing the developer to update certain parts of the Component.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Component creation&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p is-selected"&gt;The first cycle is the creation for component, which usually happens the first time a component is encountered in the parsed JSX tree:&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Constructor&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;componentWillMount&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;render&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Create All Child Components&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;componentDidMount&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Component re-rendering due to re-rendering of the parent component / Component re-rendering due to internal change&lt;/strong&gt;&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;getDerivedStateFromProps&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;shouldComponentUpdate : — if return yes goto step 3 else stop here&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;getSnapShotBeforeUpdate&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Rerender All Child Components WIth new Props&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;componentDidUpdate&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Component re-rendering due to call to &lt;/strong&gt;&lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;this.forceUpdate&lt;/strong&gt;&lt;/code&gt;&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;getDerivedStateFromProps&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;getSnapShotBeforeUpdate&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Rerender All Child Components WIth new Props&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;componentDidUpdate&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Component re-rendering due to catching an error&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Introduced in React 16 as “ErrorBoundaries”. A component can define a special layer which can catch errors and provide a new life-cycle method — &lt;code class="markup--code markup--p-code"&gt;componentDidCatch&lt;/code&gt; - which allows developers to provide self-repair actions for recovery or graceful handling of errors.&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;render If is populate any error move to step 2 else step 3&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Show error data&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Send new props to all child data&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Thrown error in any life cycle method&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Parent componentDidCatch()&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;render()&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;constructor&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;constructors are the basic of OOP — this is a special function that will get called whenever a new object is created. It’s very important to call a special function &lt;code class="markup--code markup--p-code"&gt;super&lt;/code&gt; in cases where our class extends any other class that also has a defined constructor. Calling this special function will call the constructor of our parent class and allow it to initialize itself. This is why we have access to &lt;code class="markup--code markup--p-code"&gt;this.props&lt;/code&gt; only after we’ve initially called &lt;code class="markup--code markup--p-code"&gt;super&lt;/code&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;As mentioned, constructors are perfect for setting up our Component — create any fields (variables starting with &lt;code class="markup--code markup--p-code"&gt;this.&lt;/code&gt;) or initialize state based on props received.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;This is also the only place where you are expected to change/set the state by directly overwriting the &lt;code class="markup--code markup--p-code"&gt;this.state&lt;/code&gt; fields. In all other instances remember to use &lt;code class="markup--code markup--p-code"&gt;this.setState&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DO&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;set initial state&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;if not using class properties syntax — prepare all class fields and bind functions that will be passed as callbacks&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DON’T&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;cause any side effects (AJAX calls etc.)&lt;/li&gt;&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;deprecated — componentWillMount&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;This is a somehow special case — &lt;code class="markup--code markup--p-code"&gt;componentWillMount&lt;/code&gt; does not differ much from constructor - it is also called once only in the initial mounting life-cycle. Historically there were some reasons to use &lt;code class="markup--code markup--p-code"&gt;componentWillMount&lt;/code&gt;over &lt;code class="markup--code markup--p-code"&gt;constructor&lt;/code&gt; &lt;a href="https://github.com/reactjs/react-redux/issues/129" class="markup--anchor markup--p-anchor" rel="noopener"&gt;see this react-redux issue&lt;/a&gt; but please keep in mind that the practice described there is since deprecated.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Many will be tempted to use this function in order to send a request to fetch data and expect the data to be available before the initial render is ready. This is not the case — while the request will be initialized before the render, it will not be able to finish before the render is called.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Additionally, with the changes to React Fiber (post-React 16 beta release) this function might end up being called multiple times before the initial &lt;code class="markup--code markup--p-code"&gt;render&lt;/code&gt; is called so might result in triggering multiple side-effects. Due to this fact it is &lt;strong class="markup--strong markup--p-strong"&gt;not&lt;/strong&gt; recommended to use this function for any side-effect causing operations.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;It is important to note that this function is called when using server-side-rendering while it is counterpart — &lt;code class="markup--code markup--p-code"&gt;componentDidMount&lt;/code&gt; will not be called on the server but on the client in such case. So if some side-effect &lt;em class="markup--em markup--p-em"&gt;is desired&lt;/em&gt; on the server part this function should be used as an exception.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;A &lt;code class="markup--code markup--p-code"&gt;setState&lt;/code&gt; used in this function is “free” and will not trigger a re-render.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DO&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;update state via &lt;code class="markup--code markup--li-code"&gt;this.setState&lt;/code&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;perform last-minute optimization&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;cause side-effects (AJAX calls etc.) &lt;strong class="markup--strong markup--li-strong"&gt;in case of server-side-rendering only&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DON’T&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;cause any side effects (AJAX calls etc.) on the client side&lt;/li&gt;&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;deprecated — componentWillReceiveProps(nextProps) In the latest version of react native app we can use this function as UNSAFE_componentWillReceiveProps(nextProps)&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;This function will be called in each update life-cycle caused by changes to props (parent component re-rendering) and will be passed an object map of all the props passed, no matter if the prop value has changed or not since previous re-render phase.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;This function is ideal if you have a component whose parts of the state are depending on props passed from parent component as calling &lt;code class="markup--code markup--p-code"&gt;this.setState&lt;/code&gt; here will not cause an extra render call.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Please keep in mind that due to the fact that the function is called with all props, even those that did not change it is expected the developers implement a check to determine if the actual value has changed, for example:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;componentWillReceiveProps(nextProps) {&lt;br&gt;  &lt;strong class="markup--strong markup--pre-strong"&gt;if&lt;/strong&gt;(nextProps.myProp !== &lt;strong class="markup--strong markup--pre-strong"&gt;this&lt;/strong&gt;.props.myProps) {&lt;br&gt;    // nextProps.myProp has a different value than our current prop&lt;br&gt;    // so we can perform some calculations based on the new value&lt;br&gt;  }&lt;br&gt;}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Due to the fact that with React Fiber (post 16 beta) this function might be called multiple times before the &lt;code class="markup--code markup--p-code"&gt;render&lt;/code&gt;function is actually called it is &lt;strong class="markup--strong markup--p-strong"&gt;not recommended&lt;/strong&gt; to use any side-effect causing operations here.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DO&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;sync state to props&lt;/li&gt;&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DON’T&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;cause any side effects (AJAX calls etc.)&lt;/li&gt;&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;static getDerivedStateFromProps(nextProps, prevState)&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;The new function which main responsibility is ensuring that the state and props are in sync for when it is required. Its main job is replacing &lt;em class="markup--em markup--p-em"&gt;componentWillReceiveProps&lt;/em&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;gDSFP&lt;/code&gt; is a static function and as such has no access to &lt;code class="markup--code markup--p-code"&gt;this&lt;/code&gt; — you are instead expected to return an object, which will be merged into the future state of the component (exactly like working with &lt;code class="markup--code markup--p-code"&gt;setState&lt;/code&gt;!)&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The function is used when a component is updated but also when it is mounted, right after the &lt;code class="markup--code markup--p-code"&gt;constructor&lt;/code&gt; was called, so you no longer need to use constructor or class property form of state if you want to set initial state from props.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DO&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;sync state to props&lt;/li&gt;&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DON’T&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;cause any side effects (AJAX calls etc.)&lt;/li&gt;&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;shouldComponentUpdate(nextProps, nextState, nextContext)&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;By default, all class-based Components will re-render themselves whenever the props they receiver, their state or context changes. If re-rendering the component is computation heavy (e.g. generating a chart) or is not recommended for some performance reasons, the developer is given access to a special function which will be called in the update cycle.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;This function will be called internally with next values of props, state, and object. The developer can use those to verify that the change requires a re-render or not and return &lt;code class="markup--code markup--p-code"&gt;false&lt;/code&gt; to prevent the re-rendering from happening. In other cases, you are expected to return &lt;code class="markup--code markup--p-code"&gt;true&lt;/code&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DO&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;use for increasing performance of poor performing Components&lt;/li&gt;&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DON’T&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;cause any side effects (AJAX calls etc.)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;call &lt;code class="markup--code markup--li-code"&gt;this.setState&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;deprecated — componentWillUpdate(nextProps, nextState) In the latest version of react-native we can this functions as UNSAFE_componentWillUpdate(nextProps, nextState)&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;If the &lt;code class="markup--code markup--p-code"&gt;shouldComponentUpdate&lt;/code&gt; function is not implemented, or it decided that the component should update in this render cycle, another life-cycle function will be called. This function is commonly used to perform state and props synchronization for when parts of your state are based on props.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In cases where &lt;code class="markup--code markup--p-code"&gt;shouldComponentUpdate&lt;/code&gt; is implemented, this function can be used instead of &lt;code class="markup--code markup--p-code"&gt;componentWillReceiveProps&lt;/code&gt; as it will be called only when the component will actually be re-rendered.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Similarly to all other &lt;code class="markup--code markup--p-code"&gt;componentWill*&lt;/code&gt; functions, this function might end up called multiple times before &lt;code class="markup--code markup--p-code"&gt;render&lt;/code&gt; so it &lt;strong class="markup--strong markup--p-strong"&gt;not&lt;/strong&gt; advised to perform side-effects causing operations here.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DO&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;synchronize state to props&lt;/li&gt;&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DON’T&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;cause any side effects (AJAX calls etc.)&lt;/li&gt;&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;getSnapshotBeforeUpdate(prevProps, prevState)&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Other of the two new functions, invoked in the so-called “pre-commit phase”, right before the changes from VDOM are to be reflected in the DOM.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;It is used mostly if you need to read the current DOM state, for example, you have an application in which new messages are added to the top of the screen — if a user scrolled down, and a new message is added the screen could move and make the UI harder to use. By adding &lt;code class="markup--code markup--p-code"&gt;getSnapshotBeforeUpdate&lt;/code&gt; you can calculate current scroll position and maintain it through the DOM update.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Even though the function is not static, it is recommended to return the value, not update the component. The returned value will be passed to &lt;code class="markup--code markup--p-code"&gt;componentDidUpdate&lt;/code&gt; as the 3rd parameter&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DO&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;synchronize state to props&lt;/li&gt;&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DON’T&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;cause any side effects (AJAX calls etc.)&lt;/li&gt;&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;componentDidUpdate(prevProps, prevState, prevContext)&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;This function will be called after &lt;code class="markup--code markup--p-code"&gt;render&lt;/code&gt; is finished in each of the re-render cycles. This means that you can be sure that the component and all its sub-components have properly rendered itself.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Due to the fact that this is the only function that is guaranteed to be called only once in each re-render cycle, it is recommended to use this function for any side-effect causing operations. Similarly to &lt;code class="markup--code markup--p-code"&gt;componentWillUpdate&lt;/code&gt;and &lt;code class="markup--code markup--p-code"&gt;componentWillReceiveProps&lt;/code&gt; this function is called with object-maps of &lt;strong class="markup--strong markup--p-strong"&gt;previous&lt;/strong&gt; props, state, and context, even if no actual change happened to those values. Because of that developers are expected to manually check if given value changed and only then perform various update operations:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;componentDidUpdate(prevProps) {&lt;br&gt;  if(prevProps.myProps !== this.props.myProp) {&lt;br&gt;    // this.props.myProp has a different value&lt;br&gt;    // we can perform any operations that would &lt;br&gt;    // need the new value &lt;strong class="markup--strong markup--pre-strong"&gt;and&lt;/strong&gt;/&lt;strong class="markup--strong markup--pre-strong"&gt;or&lt;/strong&gt; cause side-effects &lt;br&gt;    // like AJAX calls with the new value - this.props.myProp&lt;br&gt;  }&lt;br&gt;}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DO&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;cause side effects (AJAX calls etc.)&lt;/li&gt;&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DON’T&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;call &lt;code class="markup--code markup--li-code"&gt;this.setState&lt;/code&gt; as it will result in a re-render&lt;/li&gt;&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;An exception to the above rule is updating the state based on some DOM property which can be only computed once a component has re-rendered (e.g. position/dimensions of some DOM nodes). Please take extra care to prevent against updating if the value did not in fact change as it might result in a render loop.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;componentDidCatch(errorString, errorInfo)&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;A new addition in React 16 — this life-cycle method is special in the way that it can react to events happening in the child component, specifically to any uncaught errors happening in any of the child components.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;With this addition you can make your parent-element handle the error by — for example — setting the error info in state and returning appropriate message in its render, or logging to the reporting system, e.g.:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;componentDidCatch(errorString, errorInfo) {&lt;br&gt;  this.&lt;strong class="markup--strong markup--pre-strong"&gt;setState&lt;/strong&gt;({&lt;br&gt;    &lt;strong class="markup--strong markup--pre-strong"&gt;error&lt;/strong&gt;: errorString&lt;br&gt;  });&lt;br&gt;  ErrorLoggingTool.&lt;strong class="markup--strong markup--pre-strong"&gt;log&lt;/strong&gt;(errorInfo);&lt;br&gt;}&lt;strong class="markup--strong markup--pre-strong"&gt;render&lt;/strong&gt;() {&lt;br&gt;  &lt;strong class="markup--strong markup--pre-strong"&gt;if&lt;/strong&gt;(this.state.&lt;strong class="markup--strong markup--pre-strong"&gt;error&lt;/strong&gt;) &lt;strong class="markup--strong markup--pre-strong"&gt;return&lt;/strong&gt; &amp;lt;ShowErrorMessage &lt;strong class="markup--strong markup--pre-strong"&gt;error&lt;/strong&gt;={this.state.&lt;strong class="markup--strong markup--pre-strong"&gt;error&lt;/strong&gt;} /&amp;gt;&lt;br&gt;  &lt;strong class="markup--strong markup--pre-strong"&gt;return&lt;/strong&gt; (&lt;br&gt;    // render normal component output&lt;br&gt;  );&lt;br&gt;}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;When an error happens, the function will be called with:&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;errorString — the &lt;code class="markup--code markup--li-code"&gt;.toString()&lt;/code&gt; the message of the error&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;errorInfo — an object with a single field &lt;code class="markup--code markup--li-code"&gt;componentStack&lt;/code&gt; which represent the stack trace back to where the error occurred, e.g.:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="graf graf--pre graf-after--li"&gt;in Thrower&lt;br&gt;    in div (created &lt;strong class="markup--strong markup--pre-strong"&gt;by&lt;/strong&gt; App)&lt;br&gt;    in App&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;componentDidMount&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;This function will be called only once in the whole life-cycle of a given component and it being called signalizes that the component — and all its sub-components — rendered properly.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Since this function is guaranteed to be called only once it is a perfect candidate for performing any side-effect causing operations such as AJAX requests.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DO&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;cause side effects (AJAX calls etc.)&lt;/li&gt;&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DON’T&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;call &lt;code class="markup--code markup--li-code"&gt;this.setState&lt;/code&gt; as it will result in a re-render&lt;/li&gt;&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;An exception to the above rule is updating the state based on some DOM property which can be only computed once a component has re-rendered (e.g. position/dimensions of some DOM nodes). Please take extra care to prevent against updating if the value did not in fact change as it might result in a render loop.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;componentWillUnmount&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Use this function to “clean up” after the component if it takes advantage of timers (&lt;code class="markup--code markup--p-code"&gt;setTimeout&lt;/code&gt;, &lt;code class="markup--code markup--p-code"&gt;setInterval&lt;/code&gt;), opens sockets or performs any operations we need to close/remove when no longer needed.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DO&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;remove any timers or listeners created in the lifespan of the component&lt;/li&gt;&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;DON’T&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;call &lt;code class="markup--code markup--li-code"&gt;this.setState&lt;/code&gt;, start new listeners or timers&lt;/li&gt;&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3 graf--trailing"&gt;In this post, you learned about React js and React Native life cycle hooks.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>lifecycle</category>
      <category>hooks</category>
    </item>
    <item>
      <title>Ionic 4 and Angular WooCommerce Tutorial</title>
      <dc:creator>Umang Darji</dc:creator>
      <pubDate>Thu, 26 Mar 2020 01:04:16 +0000</pubDate>
      <link>https://forem.com/enappd/ionic-4-and-angular-woocommerce-tutorial-4p86</link>
      <guid>https://forem.com/enappd/ionic-4-and-angular-woocommerce-tutorial-4p86</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;This is Part-2 of two post series. In this post, you will learn how to implement the WooCommerce REST API Mobile App in Ionic 4 . 🔥 Part 1 of the series discusses how to use Wordpress Post Integration using &lt;a href="https://enappd.com/blog/wordpress-integration-with-ionic-4-app/71/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Wordpress REST API In Ionic 4 app&lt;/a&gt;&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;You can check out this App it has all the ecommerce features already implemented:-&lt;/strong&gt;&lt;a href="https://store.enappd.com/product/ionic-4-woocommerce-starter/" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;Ionic 4 Woocommerce Complete app&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Throughout this tutorial, we are going to build a full &lt;strong class="markup--strong markup--p-strong"&gt;Ionic 4 eCommerce&lt;/strong&gt; app with a WooCommerce backend designed for people who need an Android/iOS mobile app for their WooCommerce based store.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;We are going to use Ionic 4 for front end and WordPress + WooCommerce for the back-end&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is &lt;strong class="markup--strong markup--h3-strong"&gt;WooCommerce&lt;/strong&gt;?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;WooCommerce&lt;/strong&gt; is an &lt;a href="https://en.wikipedia.org/wiki/Open-source_software" class="markup--anchor markup--p-anchor" title="Open-source software" rel="noopener"&gt;open-source&lt;/a&gt; &lt;a href="https://en.wikipedia.org/wiki/E-commerce" class="markup--anchor markup--p-anchor" title="E-commerce" rel="noopener"&gt;e-commerce&lt;/a&gt; &lt;a href="https://en.wikipedia.org/wiki/Plug-in_%28computing%29" class="markup--anchor markup--p-anchor" title="Plug-in (computing)" rel="noopener"&gt;plugin&lt;/a&gt; for &lt;a href="https://en.wikipedia.org/wiki/WordPress" class="markup--anchor markup--p-anchor" title="WordPress" rel="noopener"&gt;WordPress&lt;/a&gt;. It is designed for small to large-sized online &lt;a href="https://en.wikipedia.org/wiki/Merchants" class="markup--anchor markup--p-anchor" title="Merchants" rel="noopener"&gt;merchants&lt;/a&gt; using WordPress. Launched on September 27, 2011,&lt;a href="https://en.wikipedia.org/wiki/WooCommerce#cite_note-3" class="markup--anchor markup--p-anchor" rel="noopener"&gt;[3]&lt;/a&gt; the plugin quickly became popular for its simplicity to install and customize and free base product.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is Ionic 4?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;You probably already know about Ionic, but I’m putting it here just for the sake of beginners. &lt;strong class="markup--strong markup--p-strong"&gt;Ionic&lt;/strong&gt; is a complete open-source SDK for hybrid mobile app development created by &lt;a href="https://medium.com/u/a76fa51de1ba?source=post_page---------------------------" class="markup--anchor markup--p-anchor"&gt;Max Lynch&lt;/a&gt;, &lt;a href="https://medium.com/u/14b1be5c1354?source=post_page---------------------------" class="markup--anchor markup--p-anchor"&gt;Ben Sperry&lt;/a&gt; and Adam Bradley of Drifty Co. in 2013. Ionic provides tools and services for developing hybrid mobile apps using Web technologies like CSS, HTML5, and Sass. Apps can be built with these Web technologies and then distributed through native app stores to be installed on devices by leveraging Cordova.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;So, in other words — If you create Native apps in Android, you code in Java. If you create Native apps in iOS, you code in Obj-C or Swift. Both of these are powerful but complex languages. &lt;strong class="markup--strong markup--p-strong"&gt;With Cordova (and Ionic) you can write a single piece of code for your app that can run on both iOS and Android &lt;/strong&gt;(and windows!), that too with the simplicity of HTML, CSS, and JS.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Tutorial requirements&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;This tutorial requires you to have&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;A local WordPress installation with WooCommerce installed and configured.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Or a hosted WooCommerce store which you can test with.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Node.js and Ionic CLI installed on your development machine.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Some working experience with Ionic 4.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;We are not going to cover how to install WordPress and how to add the WooCommerce plugin since you can find many tutorials on the web already showing that.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Setting up a WooCommerce API?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;This app uses basic authentication over SSL to pull products from the WooCommerce REST API.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;To use the WooCommerce module, you must create a REST API key in WooCommerce: &lt;a href="http://woocommerce.github.io/woocommerce-rest-api-docs/#authentication" class="markup--anchor markup--p-anchor" rel="nofollow noopener"&gt;&lt;/a&gt;&lt;a href="http://woocommerce.github.io/woocommerce-rest-api-docs/#authentication"&gt;http://woocommerce.github.io/woocommerce-rest-api-docs/#authentication&lt;/a&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;consumer key: ck_bc98995c28477bc2fce7bb5eb49e7cc839c71801&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;consumer secret: cs_66c7d6d45ae47e8a490f6fe8540298e1c77fd060&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;With the help of these two keys, you can access your woocommerce Project in your ionic app&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Included features:&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;WP-API v2 and WooCommerce REST API v2 integration&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;User Auth&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Product list&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Single product pages&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Add to cart&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Cart modal&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Basic multi-step checkout&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;Structure&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;We’ll follow a stepped approach to create a Music player app in Ionic 4. We’ll use an IONIC native plugin for music playback. Following are the steps&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Step 1 — Create a basic Ionic 4 app&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Step 2 — Set up your app for WooCommerce&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Step 3 — Set Authentication in your app&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Step 4 — Fetch Products from your WooCommerce with REST api&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Step 5 — Basic Check Out Flow&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;So let’s dive right in!&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CwkI8D1o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2A9-k-XhV-slcNcdg5kQH-wg.gif"&gt;&lt;br&gt;Dive In&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 1 — Create a basic Ionic 4 app&lt;/h3&gt;
&lt;blockquote class="graf graf--blockquote graf-after--h3"&gt;
&lt;em class="markup--em markup--blockquote-em"&gt;I have covered this topic in detail in &lt;/em&gt;&lt;a href="https://enappd.com/blog/how-to-create-an-ionic-4-app-for-beginners/13/?source=post_page---------------------------" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;this blog&lt;/em&gt;&lt;/a&gt;&lt;em class="markup--em markup--blockquote-em"&gt;.&lt;/em&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;In short, the steps you need to take here are&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Make sure you have node installed in the system (V10.15.3 at the time of this blog post)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Install &lt;strong class="markup--strong markup--li-strong"&gt;ionic cli &lt;/strong&gt;using npm (my Ionic version is 4.1.0 currently)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Create an Ionic app using &lt;code class="markup--code markup--li-code"&gt;ionic start&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;You can create a &lt;code class="markup--code markup--p-code"&gt;sidemenu&lt;/code&gt; starter for the sake of this tutorial. On running &lt;code class="markup--code markup--p-code"&gt;ionic start ionic-4-local-notifications sidemenu&lt;/code&gt; , node modules will be installed. Once the installation is done, run your app on browser using&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;$ ionic serve&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;The app will launch on the browser. You can go to &lt;strong class="markup--strong markup--p-strong"&gt;Inspect → Device Mode&lt;/strong&gt; to see the code in a mobile layout. You can create a basic layout for triggering WooCommerce product.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--HH40Dq-L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AGudYGakaXllCKfk_HqcZoQ.jpeg"&gt;&lt;br&gt;Step 2 — Set up your app for WooCommerceHome Page&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 2 — Set up your app for WooCommerce&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;For getting WooCommerce product in the Ionic app we will use WooCommerce API without any plugin.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Before we go into creating our views we set up the logic to retrieve all product. In our post, we will simply make a call to get a list of products, but you can get basically all data from the &lt;a href="http://woocommerce.github.io/woocommerce-rest-api-docs" class="markup--anchor markup--p-anchor" rel="noopener"&gt;WooCommerce API&lt;/a&gt; like categories, tags, pages, reviews…&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;We will also limit our calls to only retrieve &lt;strong class="markup--strong markup--p-strong"&gt;10 Products&lt;/strong&gt; at a time and also use the page parameter so we can later add some cool loading to our list.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In the very first step, we need to include the module to make Http calls to the API so we will import &lt;code class="markup--code markup--p-code"&gt;HttpClientModule&lt;/code&gt; from &lt;code class="markup--code markup--p-code"&gt;@angular/common/http&lt;/code&gt; which comes by default installed with IONIC package.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;so change your &lt;strong class="markup--strong markup--p-strong"&gt;app/app.module.ts&lt;/strong&gt; to:&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Now we will create pages for our app. We will have multiple pages in our app for handling Auth and Product checkout flow. so we will generate this page by command &lt;code class="markup--code markup--p-code"&gt;ionic g page — -&lt;/code&gt; . when we generate a page from this command we will not need to add routes in our &lt;code class="markup--code markup--p-code"&gt;app/app-routing.module.ts&lt;/code&gt; .&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;This command generates it automatically.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;so after adding routes your &lt;code class="markup--code markup--p-code"&gt;app/app-routing.module.ts&lt;/code&gt; something looks like this.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 3 — Set Authentication in your app&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In Authentication flow of user, we will add This Features&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Login User&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Register User&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 class="graf graf--h4 graf-after--li"&gt;Login User:-&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;You can create a basic layout for triggering User Login Flow.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--NIguDLor--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AYjNdCa3_vK0yrXe1LyiI5Q.jpeg"&gt;&lt;br&gt;Log In Screen&lt;p class="graf graf--p graf-after--figure"&gt;For login user, you can use this function&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Here you have to change URL value with your WordPress URL.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Register User: —&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;You can create a basic layout for triggering Register User Flow.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--hFS8Sp7f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2Ak5MZzc_RQKH8phULlXpX6Q.jpeg"&gt;&lt;br&gt;User Register Screen&lt;p class="graf graf--p graf-after--figure"&gt;For Register user, you can use this function&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Here you have to change URL, consumerKey, consumerSecret with yours.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 4 — Fetch Products from your WooCommerce with REST API&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;we will divide this step into further points&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Fetch products from woocommerce&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Fetch product details&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Add Product to the cart&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 class="graf graf--h4 graf-after--li"&gt;Fetch products from woocommerce&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;You can create a basic layout for triggering Products List.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--HH40Dq-L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AGudYGakaXllCKfk_HqcZoQ.jpeg"&gt;&lt;br&gt;Product Page&lt;p class="graf graf--p graf-after--figure"&gt;For getting product list you can use this function.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Don't forget to change url, consumerKey, consumerSecret with yours&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;you can also filter your product according to your requirements like this:&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;In attr, we can use different parameters like tags, categories, etc&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Fetch product details&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;You can create a basic layout for triggering Product details.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZBru7njr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2A41sYM6rGAEgJUwzBYQGwtg.jpeg"&gt;&lt;br&gt;Product details&lt;p class="graf graf--p graf-after--figure"&gt;For getting product details you can use this function&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;You probably already know about You have to change url, consumerKey, consumerSecret, but I’m putting it here just to make sure you don't forget about it.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Add Product to the cart&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;for cart feature, we are using &lt;code class="markup--code markup--p-code"&gt;Storage&lt;/code&gt; API from &lt;code class="markup--code markup--p-code"&gt;@ionic/storage&lt;/code&gt; if you want to learn more about this You can refer to this link :- &lt;a href="https://enappd.com/blog/ionic-4-save-and-retrieve-data-locally-on-device/59/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Ionic 4 — Save and Retrieve Data Locally on Device&lt;/a&gt;. Here we have explained all the storage features.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;You can create a basic layout for triggering cart for the user.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--qmBGmn_a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AgQZ6pvY_V0zuxqxgdeAnlw.jpeg"&gt;&lt;br&gt;Cart Page&lt;p class="graf graf--p graf-after--figure"&gt;And you can use these functions for User cart Flow.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Add Into cart&lt;/strong&gt;&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Get Data from cart&lt;/strong&gt;&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Remove Data From Cart&lt;/strong&gt;&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 5 — Basic Check Out Flow&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;You can create a basic layout for triggering checkout flow for the user.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--0D_RB0PF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AR17GvrffiN68JfX_cgyugA.jpeg"&gt;&lt;br&gt;Check Out Flow&lt;p class="graf graf--p graf-after--figure"&gt;In checkout flow, you can use three woocommerce functions&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Get our all payment gateways&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Update user Address&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Create Order&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Get all user orders&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 class="graf graf--h4 graf-after--li"&gt;Get our all payment gateways: —&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;For getting all payment gateways you can use this function.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;h4 class="graf graf--h4 graf-after--figure"&gt;update user Address: —&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;For updating user address you can use this function&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;h4 class="graf graf--h4 graf-after--figure"&gt;Create Order: —&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;For creating user order you can use this function&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;h4 class="graf graf--h4 graf-after--figure"&gt;Get all user orders: —&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;For getting all user order you can use this function&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this blog you learnt how to implement WooCommerce in an Ionic 4 app. This feature is useful when want to build our own ECommerce Startup&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;That’s all for this blog.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Stay tuned for more Ionic blogs!&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;You can check out this App it has all the ecommerce features already implemented:-&lt;/strong&gt;&lt;a href="https://store.enappd.com/product/ionic-4-woocommerce-starter/" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;Ionic 4 Woocommerce Complete app&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;The Pros and Cons of This Approach&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;First, why would you want to build a WooCommerce app when you have a mobile website? Besides the obvious reason of being on the app store, here are a few benefits:&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;It’s really fast, way faster than your website.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;The user experience is awesome, which could mean higher conversions.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li is-selected"&gt;It works offline or in places with a poor network connection.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;It can be used as a native mobile app or a progressive web app.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;There are also cons to this type of app, so it’s not for everyone. There are 2 major drawbacks to using the REST API in an app:&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;None of your customizations or plugins work in the app (custom checkout fields for example) You can customize the app, it just doesn’t automatically mimic your existing site.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;You have to custom code payment gateways. The WC REST API does not support payments, so you have to do that yourself.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;One solution to these problems is using an iframe to display your checkout, which would automatically use any customizations you made on your site. There are some big downsides to that approach, you lose some of the offline functionality and it’s a worse checkout experience.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;I decided to go full API with this project, mostly for fun. It allows for more offline support, faster checkout, and better overall user experience.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learnt the implementation of Firebase push notifications in Ionic 4, you can also try&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;a href="https://enappd.com/blog/ionic-4-paypal-payment-integration-for-apps-and-pwa/16" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener noopener"&gt;Ionic 4 PayPal payment integration — for Apps and PWA&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/ionic-4-stripe-payment-integration-with-firebase-for-apps-and-pwa/17" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener noopener"&gt;Ionic 4 Stripe payment integration — for Apps and PWA&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-integrate-apple-pay-in-ionic-4-apps/21" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener noopener"&gt;Ionic 4 Apple Pay integration&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/twitter-login-in-ionic-4-apps-using-firebase/24" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login in Ionic 4 with Firebase&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/facebook-login-in-ionic-4-apps-using-firebase/25" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Facebook login in Ionic 4 with Firebase&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://medium.com/enappd/using-geolocation-and-beacon-plugins-in-ionic-4-754b41304007" class="markup--anchor markup--li-anchor"&gt;Geolocation&lt;/a&gt; in Ionic 4&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://medium.com/enappd/qr-code-scanning-and-optical-character-recognition-ocr-in-ionic-4-95fd46be91dd" class="markup--anchor markup--li-anchor"&gt;QR Code and scanners&lt;/a&gt; in Ionic 4 and&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://medium.com/enappd/how-to-translate-in-ionic-4-globalization-internationalization-and-localization-31ec5807a8bc" class="markup--anchor markup--li-anchor"&gt;Translations in Ionic 4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next Ionic 4 app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/ionic-4-full-app/" class="markup--anchor markup--p-anchor" rel="noopener nofollow noopener noopener nofollow noopener noopener nofollow noopener noopener noopener noopener"&gt;Ionic 4 Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--lIrdSD8D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2A2BzL8TesnBHuazHr3VA4SQ.jpeg"&gt;&lt;br&gt;Use Ionic 4 Full app for your next awesome app

</description>
      <category>ionic</category>
      <category>woocommerce</category>
      <category>ecommerce</category>
      <category>angular</category>
    </item>
    <item>
      <title>Ionic and Wordpress Integration using Wordpress REST API</title>
      <dc:creator>Umang Darji</dc:creator>
      <pubDate>Thu, 26 Mar 2020 00:27:47 +0000</pubDate>
      <link>https://forem.com/enappd/ionic-and-wordpress-integration-using-wordpress-rest-api-5ffk</link>
      <guid>https://forem.com/enappd/ionic-and-wordpress-integration-using-wordpress-rest-api-5ffk</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;This is Part-1 of two post series. In this post, you will learn how to implement Wordpress Integration using Wordpress REST in Ionic 4 app. Part 2 of the series discusses how to build a WooCommerce REST API Mobile App in Ionic 4.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete code of this blog post can be found at this github repo — &lt;/strong&gt;&lt;a href="https://github.com/enappd/ionic4-wordpress-integration.git" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;ionic-wordpress-integration&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;What is Wordpress REST API?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;The WordPress REST API provides API endpoints for WordPress data types that allow developers to interact with sites remotely by sending and receiving JSON. This enables developers to create, read and update WordPress content from client-side JavaScript or from external applications.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;If you are new to WP REST API, I would suggest you go through the &lt;a href="https://developer.wordpress.org/rest-api/#key-concepts" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Key Concepts&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is Ionic 4?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;You probably already know about Ionic, but put this section in every blog just for the sake of beginners. &lt;strong class="markup--strong markup--p-strong"&gt;Ionic&lt;/strong&gt; is a complete open-source SDK for hybrid mobile app development. Ionic provides tools and services for developing hybrid mobile apps using Web technologies like CSS, HTML5, and Sass. Apps can be built with these Web technologies and then distributed through native app stores to be installed on devices.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In other words — If you create native apps in Android, you code in &lt;strong class="markup--strong markup--p-strong"&gt;Java&lt;/strong&gt;. If you create native apps in iOS, you code in &lt;strong class="markup--strong markup--p-strong"&gt;Obj-C&lt;/strong&gt; or &lt;strong class="markup--strong markup--p-strong"&gt;Swift&lt;/strong&gt;. Both of these are powerful, but complex languages. With Cordova (and Ionic) you can write a single piece of code for your app that can run on both iOS and Android (and windows!), that too with the simplicity of HTML, CSS, and JS. I’m a huge fan of Ionic and been developing Ionic apps for last 4 years.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In this ionic tutorial, we will walk you through the process of creating an Ionic 4 app that pulls in WordPress posts and other content using the WP REST API.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Without further ado, this is what you are going to build!&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ml3REpWM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2Apk2p7Py38Ft1Bjk3GpPSvA.gif"&gt;&lt;br&gt;Word Press App&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Structure&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;We’ll follow a stepped approach to create a Music player app in Ionic 4. We’ll use an IONIC native plugin for music playback. Following are the steps&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Step 1 — Create a basic Ionic 4 app&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Step 2 —Set up your app for Wordpress post&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Step 3 — Get Your WordPress Posts&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Step 4 — Showing The WordPress Post Details&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;So let’s dive right in!&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 1 — Create a basic Ionic 4 app&lt;/h3&gt;
&lt;blockquote class="graf graf--blockquote graf-after--h3"&gt;
&lt;em class="markup--em markup--blockquote-em"&gt;I have covered this topic in detail in &lt;/em&gt;&lt;a href="https://enappd.com/blog/how-to-create-an-ionic-4-app-for-beginners/13/?source=post_page---------------------------" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;this blog&lt;/em&gt;&lt;/a&gt;&lt;em class="markup--em markup--blockquote-em"&gt;.&lt;/em&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;In short, the steps you need to take here are&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Make sure you have node installed in the system (V10.15.3 at the time of this blog post)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Install &lt;strong class="markup--strong markup--li-strong"&gt;ionic cli &lt;/strong&gt;using npm (my Ionic version is 4.1.0 currently)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Create an Ionic app using &lt;code class="markup--code markup--li-code"&gt;ionic start&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;You can create a &lt;code class="markup--code markup--p-code"&gt;sidemenu&lt;/code&gt; starter for the sake of this tutorial. On running &lt;code class="markup--code markup--p-code"&gt;ionic start ionic-4-local-notifications sidemenu&lt;/code&gt; , node modules will be installed. Once the installation is done, run your app on browser using&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;$ ionic serve&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;The app will launch on the browser. You can go to &lt;strong class="markup--strong markup--p-strong"&gt;Inspect → Device Mode&lt;/strong&gt; to see the code in a mobile layout. You can create a basic layout for triggering Wordpress post.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--414U-Y4X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AEXrI_WVtwplRUFeDr-yLVA.jpeg"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;Next, we’ll add the Wordpress posts our app&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 2 — Set up your app for Wordpress post&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;For getting WordPress post in the Ionic app we will use Wordpress API without any plugin.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Before we go into creating our views we set up the logic to retrieve all data. In our post, we will simply make a call to get a list of posts, but you can get basically all data from the &lt;a href="https://developer.wordpress.org/rest-api/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;WordPress API&lt;/a&gt; like categories, tags, pages…&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;We will also limit our calls to only retrieve &lt;strong class="markup--strong markup--p-strong"&gt;5 posts&lt;/strong&gt; at a time and also use the page parameter so we can later add some cool loading to our list.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In the very first step, we need to include the module to make Http calls to the API so we will import &lt;code class="markup--code markup--p-code"&gt;HttpClientModule&lt;/code&gt; from &lt;code class="markup--code markup--p-code"&gt;@angular/common/http&lt;/code&gt; which comes by default installed with IONIC package.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;so change your &lt;strong class="markup--strong markup--p-strong"&gt;app/app.module.ts&lt;/strong&gt; to:&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Now we will create pages for our app. We will have a &lt;strong class="markup--strong markup--p-strong"&gt;list of WordPress posts&lt;/strong&gt; and also a &lt;strong class="markup--strong markup--p-strong"&gt;details page&lt;/strong&gt; for one post. so we will generate this page by command &lt;code class="markup--code markup--p-code"&gt;ionic g page — -&lt;/code&gt; . when we generate a page from this command we will not need to add routes in our &lt;code class="markup--code markup--p-code"&gt;app/app-routing.module.ts&lt;/code&gt; .&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;This command generates it automatically.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;so after adding routes your &lt;code class="markup--code markup--p-code"&gt;app/app-routing.module.ts&lt;/code&gt; something looks like this.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 3 — Get Your WordPress Posts&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;For getting posts from Wordpress we will use this function&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;async loadPost(url: string, page, showLoading) {&lt;br&gt;const loading = await this.loadingController.create({&lt;br&gt;message: 'Loading Your posts'&lt;br&gt;});&lt;br&gt;if (showLoading) {&lt;br&gt;await loading.present();&lt;br&gt;}&lt;br&gt;const route = this.url + 'wp-json/wp/v2/posts'&lt;br&gt;if (!page) {&lt;br&gt;page = '1';&lt;br&gt;}&lt;br&gt;return new Promise((resolve, reject) =&amp;gt; {&lt;br&gt;var concat;&lt;br&gt;if (url.indexOf('?') &amp;gt; 0) {&lt;br&gt;concat = '&amp;amp;';&lt;br&gt;} else {&lt;br&gt;concat = '?';&lt;br&gt;}&lt;br&gt;this.http.get(route + concat + 'page=' + page)&lt;br&gt;.subscribe(data =&amp;gt; {&lt;br&gt;if (showLoading) {&lt;br&gt;loading.dismiss();&lt;br&gt;}&lt;br&gt;this.items = data;&lt;br&gt;resolve(this.items);&lt;br&gt;},&lt;br&gt;error =&amp;gt; {&lt;br&gt;if (showLoading) {&lt;br&gt;loading.dismiss();&lt;br&gt;}&lt;br&gt;reject(error);&lt;br&gt;this.presentToast(error.error.message)&lt;br&gt;})&lt;br&gt;});&lt;br&gt;}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Here we are using two params &lt;code class="markup--code markup--p-code"&gt;URL&lt;/code&gt; and another one &lt;code class="markup--code markup--p-code"&gt;page no&lt;/code&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;URL&lt;/code&gt; is basically your word press URL where you have posted all of your blogs&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;for me it is :&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;a href="https://swift-footed-config.000webhostapp.com/"&gt;https://swift-footed-config.000webhostapp.com/&lt;/a&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;you can change it with your one.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;and &lt;code class="markup--code markup--p-code"&gt;pageNo&lt;/code&gt; we have added for cool navigation with infinite scroll.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The reason is that we implement &lt;strong class="markup--strong markup--p-strong"&gt;infinite scrolling&lt;/strong&gt; inside our view which will automatically load new posts once we reach (or approach) the end of the list! That looks&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The reason is that we implement &lt;strong class="markup--strong markup--p-strong"&gt;infinite scrolling&lt;/strong&gt; inside our view which will automatically load new posts once we reach (or approach) the end of the list! That looks&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The reason is that we have also implemented &lt;strong class="markup--strong markup--p-strong"&gt;ion-refresher&lt;/strong&gt; inside our view which will allow the user to refresh post list when he wants to refresh.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;So after adding all the code your homepage.ts something looks like this.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Some of those fields contain HTML characters, that’s why we sometimes use the &lt;code class="markup--code markup--p-code"&gt;innerHTML&lt;/code&gt; of elements and directly use the value which will then be displayed correctly.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;To build our simple view, go ahead and insert this code in yout &lt;code class="markup--code markup--p-code"&gt;homepage.html&lt;/code&gt;&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;So after adding this all this code your post page something look like this&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--414U-Y4X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AEXrI_WVtwplRUFeDr-yLVA.jpeg"&gt;&lt;br&gt;Post List Page&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 4 — Showing The WordPress Post Details&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;So when user clicks on post link we will redirect him to Post details with ID of the post.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;We could actually also pass the whole object to the next page using the state, but I still think using the ID approach is better as we don’t keep the information in the state and we actually got a URL to the post page that will work all the time, even with a refresh!&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;For us, this means we need to get the ID from the route snapshot and then retrieve the information for a single post using our service!&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;so for getting post information, we will add this code in our post details file&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;getPostDetails(id) {&lt;br&gt;const route = this.url + 'wp-json/wp/v2/' + &lt;code&gt;posts/${id}?_embed&lt;/code&gt;&lt;br&gt;return this.http.get(route).pipe(&lt;br&gt;map(post =&amp;gt; {&lt;br&gt;post['media_url'] = post['_embedded']['wp:featuredmedia'][0]['media_details'].sizes['medium'].source_url;&lt;br&gt;console.log(post);&lt;br&gt;return post;&lt;br&gt;})&lt;br&gt;)}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;so after adding this code your post details file something look like this&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Regarding the view of the details page we’ll also keep it simple and just use the image (like we did before, remember the &lt;code class="markup--code markup--p-code"&gt;media_url&lt;/code&gt; is a field we created in the service!) and the actual post content.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p is-selected"&gt;Again, to display the HTML correctly we need to use &lt;code class="markup--code markup--p-code"&gt;innerHTML&lt;/code&gt; which will render the tags correctly.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;There’s really not a lot more to the page, so finish your simple Ionic WordPress app by changing your &lt;strong class="markup--strong markup--p-strong"&gt;pages/post/post.page.html&lt;/strong&gt; to:&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;so after adding this code, your post details screen something look like this.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--X5NCNVjx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2An2pNxnA9V7uT5YlYn1C-zA.jpeg"&gt;&lt;br&gt;Post Details Screen&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this post, we learned how to use Wordpress post in Ionic 4 apps. And we have also learned how to get post details from specific post id and showing it to our page with the help of &lt;code class="markup--code markup--p-code"&gt;innerHTML&lt;/code&gt;&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete code of this blog post can be found at this github repo —&lt;/strong&gt;&lt;a href="https://github.com/enappd/ionic4-wordpress-integration.git" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;ionic-wordpress-integration&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learned the implementation of Wordpress in Ionic 4, you can also try&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Ionic 4 Payment Gateways — &lt;a href="https://enappd.com/blog/ionic-4-stripe-payment-integration-with-firebase-for-apps-and-pwa/17" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe&lt;/a&gt; | &lt;a href="https://enappd.com/blog/ionic-4-paypal-payment-integration-for-apps-and-pwa/16" class="markup--anchor markup--li-anchor" rel="noopener"&gt;PayPal&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-integrate-apple-pay-in-ionic-4-apps/21" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-integrate-razorpay-in-ionic-4-apps-and-pwa/20" class="markup--anchor markup--li-anchor" rel="noopener"&gt;RazorPay&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Charts with — &lt;a href="https://enappd.com/blog/ionic-4-charts-using-google-charts/66" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Charts&lt;/a&gt;| &lt;a href="https://enappd.com/blog/adding-charts-in-ionic-4-apps-and-pwa-part-3/60" class="markup--anchor markup--li-anchor" rel="noopener"&gt;HighCharts&lt;/a&gt; | &lt;a href="https://enappd.com/blog/adding-charts-in-ionic-4-apps-and-pwa-part-2/54" class="markup--anchor markup--li-anchor" rel="noopener"&gt;d3.js&lt;/a&gt; | &lt;a href="https://enappd.com/blog/charts-in-ionic-4-apps-and-pwa-part-1/52" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Chart.js&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Social Logins — &lt;a href="https://enappd.com/blog/facebook-login-in-ionic-4-apps-using-firebase/25" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Facebook&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-login-in-ionic-4-apps-using-firebase/39" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-ionic-4-apps-using-firebase/24" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Authentications — &lt;a href="https://enappd.com/blog/email-authentication-with-firebase-in-ionic-4/38" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Via Email&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-anonymous-login-in-ionic-4/37" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Features — &lt;a href="https://enappd.com/blog/using-geolocation-geocoding-and-reverse-geocoding-in-ionic-4/45" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/qr-code-scanning-and-optical-character-recognition-ocr-in-ionic-4/9" class="markup--anchor markup--li-anchor" rel="noopener"&gt;QR Code reader&lt;/a&gt;| &lt;a href="https://enappd.com/blog/best-fitness-plugins-for-ionic-4-how-to-use-pedometer/15" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Pedometer&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Media in Ionic 4 — &lt;a href="https://enappd.com/blog/spotify-like-music-in-ionic-4-apps/48" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Audio&lt;/a&gt; | &lt;a href="https://enappd.com/blog/adding-video-player-in-ionic-4-app/64" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Video&lt;/a&gt; | &lt;a href="https://enappd.com/blog/image-picker-in-ionic-4-app/67" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-add-image-cropper-in-ionic-4-app/68" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image Cropper&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Essentials — &lt;a href="https://enappd.com/blog/ionic-4-save-and-retrieve-data-locally-on-device/59" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Native Storage&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-translate-in-ionic-4-globalization-internationalization-and-localization/11" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Translations&lt;/a&gt; | &lt;a href="https://enappd.com/blog/rtl-right-to-left-use-in-ionic-4/50" class="markup--anchor markup--li-anchor" rel="noopener"&gt;RTL&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 messaging — &lt;a href="https://enappd.com/blog/implement-ionic-4-firebase-push/34" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Firebase Push&lt;/a&gt; | &lt;a href="https://enappd.com/blog/automatically-read-sms-in-ionic-4-apps/42" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Reading SMS&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 with Firebase — &lt;a href="https://enappd.com/blog/how-to-integrate-firebase-in-ionic-4-apps/23" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Basics&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-with-ionic-4-hosting-auth-and-db-connection/58" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Hosting and DB&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-cloud-functions-in-ionic-4-complete-guide/32" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Cloud functions&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next Ionic 4 app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/ionic-4-full-app" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Ionic 4 Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--LAite3J---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/0%2A1ArpKyhiDHZnevwB.jpeg"&gt;&lt;br&gt;IONIC 4 Full App

</description>
      <category>ionic</category>
      <category>angular</category>
      <category>wordpress</category>
    </item>
  </channel>
</rss>
