Skip to content

Installation

Rui Dias edited this page Oct 16, 2021 · 1 revision
  1. Install the Firebase NPM module and this package:

    $ npm init
    $ npm install --save firebase
    $ npm install --save @netsoft/firebase
  2. Create a new app using the create-react-app (or use your own app, if already exists)

  3. Create a Firestore App (or you can use your own)

    If you haven't already, create a Firebase project: In the Firebase console, click Add project, then follow the on-screen instructions to create a Firebase project or to add Firebase services to an existing GCP project.

  4. Edit your index.js and inject the FirebaseProvider with your app's Firebase project configuration

    To initialize Firebase in your app, you need to provide your app's Firebase project configuration. You can obtain your Firebase config object at any time.

    import { FirebaseProvider } from "@netsoft/firebase";
    
    // TODO: Replace the following with your app's Firebase project configuration
    const firebaseConfig = {
        apiKey: "<apiKey>",
        authDomain: "<projectId>.firebaseapp.com",
        databaseURL: "https://<projectId>.firebaseio.com",
        projectId: "<projectId>",
        storageBucket: "projectId.appspot.com",
        messagingSenderId: "<messagingSenderId>",
        appId: "<appId>",
    };
    
    ReactDOM.render(
        <React.StrictMode>
            <FirebaseProvider config={firebaseConfig}>
                <App />
            </FirebaseProvider>
        </React.StrictMode>,
        document.getElementById("root")
    );
  5. That's it! You are now ready to go...

Clone this wiki locally