props-proxy-firebase

    1.1.2 • Public • Published

    Firebase props render for REACT

    A props proxy for firebase

    I recently use firebase in a small project and I feel the need to implement a simple props proxy for Firebase

    Test

    Test are comming soon

    Usage

    npm install --save props-proxy-firebase
    

    or

    yarn add props-proxy-firebase
    

    Create a specific file at the root of your project firebase.config.js

    like so

    module.exports = {
      "apiKey": "MY_FIREBASE_API_KEY",
      "authDomain": "MY_FIREBASE_AUTH_DOMAIN",
      "databaseURL": "MY_FIREBASE_DATABASE_URL",
      "projectId": "MY_FIREBASE_PROJECT_ID"
    }

    Then for your components:

    import firebaseHOC from 'props-proxy-firebase';
    
    const Login = ({ firebase }) => {
      return (
        <div className="layoutDefault">
          <buttton onclick={e => {
            e.preventDefault();
    
            const provider = new firebase.auth.GoogleAuthProvider();
    
            firebase
              .auth()
              .signInWithPopup(provider)
              .catch(error => {
                console.error(error);
              });
          }}>Google</button>
        </div>
      )
    }
    
    export default firebaseHOC(Login);

    Install

    npm i props-proxy-firebase

    DownloadsWeekly Downloads

    46

    Version

    1.1.2

    License

    MIT

    Last publish

    Collaborators

    • flav