/React-firebase-database-integration

Functional integration between react and firebase. Example application with firebase database.

Primary LanguageJavaScript

React-firebase-integration

Functional integration between react and firebase. In this application you can simulate the registration of an user and, in real time, see your records in a list of users that is load from the information obtained on firebase db.

Pre-requisites

You have to install Node.js.

Installation

Run these commands in the project folder

npm install
npm start

Config

If you still don’t have a Firebase account. Log in your account, go to the console and create a project. After entering the project, look for ‘add Firebase to your app on web’, it will create a code just like the one below:

<script src="https://www.gstatic.com/firebasejs/4.6.0/firebase.js"></script>
<script>
  // Initialize Firebase
  var config = {
    apiKey: "<YOUR-API-KEY>",
    authDomain: "<YOUR-PROJECT-ID>.firebaseapp.com",
    databaseURL: "https://<YOUR-PROJECT-ID>.firebaseio.com",
    projectId: "<YOUR-PROJECT-ID>",
    storageBucket: "<YOUR-PROJECT-ID>.appspot.com",
    messagingSenderId: "<YOUR-MESSAGING-SENDER-ID>"
  };
  firebase.initializeApp(config);
</script>

In the project, update the DB_CONFIG in the file /Config/config.js with all the gathered information.

Database Permissions

Verify the rules file of the database. The Rules file can be found on the second tab of menu database. If necessary, edit it, leaving the file as shown below:

{
  "rules": {
    ".read": true,
    ".write": true
  }
}

HAVE FUN!