Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rakannimer/react-firebase-firestore

Render Data from your Firestore Database
https://github.com/rakannimer/react-firebase-firestore

Last synced: 12 days ago
JSON representation

Render Data from your Firestore Database

Awesome Lists containing this project

README

        

## Docs moved to : https://react-firebase-js.com/docs/react-firestore-database/getting-started

## Source code moved to : https://github.com/rakannimer/react-firebase/

## Package moved to : `@react-firebase/firestore`

- [React Firebase Firestore](#react-firebase-firestore)
- [Usage](#usage)
- [Example](#example)
- [Reference](#reference)

# React Firebase Firestore

Easily render data from your firestore database in your react(-native) app.

React Firestore provides the following components :

- FirestoreProvider
- FirestoreCollection
- FirestoreDocument

### Usage

1. Change PROJECT_NAME to your project name and grab your firebase config here :
https://console.firebase.google.com/project/PROJECT_NAME/settings/general/

```javascript
// Firebase Config
const config = {
apiKey: "API_KEY",
projectId: "PROJECT_ID",
databaseURL: "DATABASE_URL",
authDomain: "AUTH_DOMAIN",
// OPTIONAL
storageBucket: "STORAGE_BUCKET",
messagingSenderId: "MESSAGING_SENDER_ID"
};
```

2. Place a `FirestoreProvider` Component anywhere in your component tree as an ancestor to any `FirestoreCollection` or `FirestoreDocument` and pass to it your firebase config.

### Example

```javascript
import firebase from "firebase/app";
import "firebase/firestore";
import {
FirestoreProvider,
FirestoreCollection,
FirestoreDocument
} from "react-firebase-firestore";
import ReactJson from "react-json-view";

const config = {
apiKey: credentials.apiKey,
authDomain: credentials.authDomain,
databaseURL: credentials.databaseURL,
projectId: credentials.projectId,
storageBucket: credentials.storageBucket,
messagingSenderId: credentials.messagingSenderId
};

const App = () => {
return (

oh hai


{d => {
return d.loadingStatus === "ready" ? (

) : (
"Loading"
);
}}


oh hai again



{d => {
return d.loadingStatus === "ready" ? (

) : (
"Loading"
);
}}



);
};
```

## [Reference](https://firebase.google.com/docs/firestore/)