Install Parse SDK on a React Native CLI project
In this section you will learn how to get started with Back4App using an existing or new project using the React Native CLI
To complete this tutorial, you will need:
Step 1 - Creating a new React Native project
Create a new project with
npx package runner using the following command line:
npx react-native init startWithBack4app
This method is preferred since you don’t need to install global packages.
Step 2 - Install dependencies
Make sure that you have installed
yarn in your system.
In this tutorial we are using yarn to manage dependencies but you are free to use npm instead.
To make your React Native App connect to Back4app cloud services, we also need to install the dependencies we will use in the project. These dependencies are:
- Back4App Parse SDK - To integrate your App with Back4app servers.
- React Native Async Storage - To use Parse SDK, an AsyncStorage handler is required.
On your terminal, run
cd startWithBack4app to open the project’s root directory. Then, run the following command to install dependencies:
yarn add parse @react-native-community/async-storage
Use CocoaPods to add the native
RNAsyncStorage to your project:
cd ios & npx pod-install
We are using
@react-native-community/async-storage but you can get your favorite AsyncStorage handler.
Step 3 - Setting up Parse SDK
Dashboardat Back4App Website and clicking on
On the project’s root directory, let’s create a new file at:
constants/Keys.jswith the following content:
- Copy and paste your
App.js file initialize Parse SDK:
Your App is initialized and can securely connect to Back4app cloud services. Let’s create a simple function inside the
App.js that registers installations of your App to your Back4App Database.
At this point, your
App.js file should look like this:
Step 4 - Test your connection
Open your project’s terminal.
yarn iosto open the application on your target platform
Done, the React Native Parse SDK must be installed and you also can see the device connected navigating to Back4App Dashboard and clicking on
At this point, you have learned how to get started with React Native app