Jeremy  Reilly

Jeremy Reilly

1605860148

Building a Mobile Application with Azure Cosmos DB and React Native

Building a mobile application with Azure Cosmos DB and React Native is simple… let’s give it the old college try :$. First, let’s set up our environment. I use a Mac, so adjust accordingly. To setup up our environment, we need a few things React Native, Expo, Yarn, snack (optional), and Azure Cosmos DB keys.

Image Screen Shot 2020 11 18 at 6 00 48 AM

Prerequisites

Step 1: Installing Node and Watchman

The official guide suggests using Homebrew to install Node and Watchman. First things first run the below command to install Homebrew

/bin/bash – c “$(curl –fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”

Run the following commands to install Node and Watchman.

brew install node
brew install watchman

Step 2: Creating a new Application

Now all the dependencies are installed, and we can create our new Application. Run this command to create a new React Native App

Expo

npm install --global expo-cli
expo init cosmosdb-react-native

React Native

npx react-native init cosmosdb-react-native

This command creates a new project named cosmosdb-react-native. If you’ve used “gem” to install CocoaPods, you will also need to run the pod command to install all the dependencies.

Running apps using the command line

  • First, navigate to the project folder. cd cosmosdb-react-native then execute this command to run the app in simulator next react-native run-ios
  • Running app with Xcode
  • Locate your app folder, then go to the iOS or Android folder. You will see a file named cosmosdb-react-native.xcworkspace.
  • Open the workspace file. Select an iOS or Android simulator and run your app. Tadaaa!!

Step 3: Install Azure Cosmos DB package

https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/cosmosdb/cosmos

NodeJS

Npm comes preinstalled with NodeJS. You should be using Node v10 or above.

npm install --save @azure/cosmos@latest
npm install --save isomorphic-webcrypto
npm install --save react-native-crypto
npm install --save react-native-get-random-values
npm install --save randombytes

Get Account Credentials

You will need your Azure Cosmos DB account endpoint and key. You will find these in the Azure portal or use the Azure CLI snippet below.

This snippet is formatted for the Bash shell.

az cosmosdb show --resource-group <your-resource-group> --name <your-account-name> --query documentEndpoint --output tsv
az cosmosdb list-keys --resource-group <your-resource-group> --name <your-account-name> --query documentEndpoint --output tsv

Create an instance of CosmosClient

Interaction with Azure Cosmos DB starts with an instance of the CosmosClient class

const CosmosClient = require('@azure/cosmos').CosmosClient 
const endpoint = '[endpoint]'const key = '[key]'
const databaseId = 'ToDoList'const containerId = 'Items' 
const client = new CosmosClient({ endpoint, key })

Create the query spec

const querySpec = {
     query: 'SELECT * from c'
};

Create an instance of CosmosClient

      const response = client
            .database(databaseId)
            .container(containerId)
             .items.query(querySpec)
             .fetchAll()

Source

https://github.com/jay-most/cosmosdb-react-native

https://github.com/jay-most?tab=repositories

Try for free!

The Original Article can be found on microsoft.com

#react-native #azure #mobile-apps #programming #developer

What is GEEK

Buddha Community

Building a Mobile Application with Azure Cosmos DB and React Native
Autumn  Blick

Autumn Blick

1598839687

How native is React Native? | React Native vs Native App Development

If you are undertaking a mobile app development for your start-up or enterprise, you are likely wondering whether to use React Native. As a popular development framework, React Native helps you to develop near-native mobile apps. However, you are probably also wondering how close you can get to a native app by using React Native. How native is React Native?

In the article, we discuss the similarities between native mobile development and development using React Native. We also touch upon where they differ and how to bridge the gaps. Read on.

A brief introduction to React Native

Let’s briefly set the context first. We will briefly touch upon what React Native is and how it differs from earlier hybrid frameworks.

React Native is a popular JavaScript framework that Facebook has created. You can use this open-source framework to code natively rendering Android and iOS mobile apps. You can use it to develop web apps too.

Facebook has developed React Native based on React, its JavaScript library. The first release of React Native came in March 2015. At the time of writing this article, the latest stable release of React Native is 0.62.0, and it was released in March 2020.

Although relatively new, React Native has acquired a high degree of popularity. The “Stack Overflow Developer Survey 2019” report identifies it as the 8th most loved framework. Facebook, Walmart, and Bloomberg are some of the top companies that use React Native.

The popularity of React Native comes from its advantages. Some of its advantages are as follows:

  • Performance: It delivers optimal performance.
  • Cross-platform development: You can develop both Android and iOS apps with it. The reuse of code expedites development and reduces costs.
  • UI design: React Native enables you to design simple and responsive UI for your mobile app.
  • 3rd party plugins: This framework supports 3rd party plugins.
  • Developer community: A vibrant community of developers support React Native.

Why React Native is fundamentally different from earlier hybrid frameworks

Are you wondering whether React Native is just another of those hybrid frameworks like Ionic or Cordova? It’s not! React Native is fundamentally different from these earlier hybrid frameworks.

React Native is very close to native. Consider the following aspects as described on the React Native website:

  • Access to many native platforms features: The primitives of React Native render to native platform UI. This means that your React Native app will use many native platform APIs as native apps would do.
  • Near-native user experience: React Native provides several native components, and these are platform agnostic.
  • The ease of accessing native APIs: React Native uses a declarative UI paradigm. This enables React Native to interact easily with native platform APIs since React Native wraps existing native code.

Due to these factors, React Native offers many more advantages compared to those earlier hybrid frameworks. We now review them.

#android app #frontend #ios app #mobile app development #benefits of react native #is react native good for mobile app development #native vs #pros and cons of react native #react mobile development #react native development #react native experience #react native framework #react native ios vs android #react native pros and cons #react native vs android #react native vs native #react native vs native performance #react vs native #why react native #why use react native

React Native Mobile App Development

React Native is a framework that allows you to build mobile applications for both Android and iOS platforms using a similar codebase. This can shorten the development time and reduce the overall cost of building mobile apps.

Looking to create Mobile Applications but low in the budget? Contact Skenix Infotech now to get the most effective React Native Mobile App Development Services.

#react native development #mobile app development #react native ios app #react native ui #react native mobile app #react native

Top Rated React Native Development Agency

AppClues Infotech is a premier & leading React Native app Development Company in USA having highly skilled React Native app developers offering robust services with the latest technology & functionalities.

For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910

#react native app development company #top react native app development company in usa #best react native app development services usa #react native mobile development #react native mobile development #top react native app development companies usa

Hire Dedicated React Native Developer

Have you ever thought of having your own app that runs smoothly over multiple platforms?

React Native is an open-source cross-platform mobile application framework which is a great option to create mobile apps for both Android and iOS. Hire Dedicated React Native Developer from top React Native development company, HourlyDeveloper.io to design a spectacular React Native application for your business.

Consult with experts:- https://bit.ly/2A8L4vz

#hire dedicated react native developer #react native development company #react native development services #react native development #react native developer #react native

Know why to consider react native as your next mobile application development

React Native is an open-source framework that gives you wings to create truly native applications that do not compromise on your users’ experiences. TechAhead is a renowned React Native app development company having years of experience and a proven track record of delivering high-quality React Native app development services in record time. Get in touch with the TechAhead consultants to get started with your next mobile app project.
For more details read our full blog here https://dripivplus.com/reasons-to-consider-react-native-for-your-next-mobile-application-development/

#react native app development company #react native app developer #react native app development service #react native app development #react native application development company