Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/dkershner6/react-hooks-firebase-auth

Library for easy handling of Firebase Authentication, complete with provider token related events
https://github.com/dkershner6/react-hooks-firebase-auth

npm-package react react-hooks

Last synced: about 2 months ago
JSON representation

Library for easy handling of Firebase Authentication, complete with provider token related events

Awesome Lists containing this project

README

        

# react-hooks-firebase-auth

Archived: I don't use Firebase anymore, but will leave this here in case it has value.

Library for easy handling of Firebase Authentication, complete with provider token related events

![Release and Publish](https://github.com/dkershner6/react-hooks-firebase-auth/workflows/Release%20and%20Publish/badge.svg)

## Sample Provider Use

```typescript
const CompleteFirebaseAuthProvider = ({ children }): ReactElement => {
return (
}
loadingComponent={

}
errorComponent={

Error

}
onNewLoginSuccess={onNewLoginSuccess}
onLogout={onLogout}
onOldLoginRetrieval={onOldLoginRetrieval}
>
{children}

);
};
```

And then for your main app file...

```typescript

```

## Sample Container use

```typescript
import { useContainer } from 'unstated-next';
import { FirebaseAuthContainer } from 'react-hooks-firebase-auth';

const Component = () => {
const { user, token } = useContainer(FirebaseAuthContainer);
};
```

## Sample Auth Enforcement

```typescript
import { EnforceFirebaseAuth } from 'react-hooks-firebase-auth';

const Component = () => {
return (



);
};
```

OR

```typescript
import { withFirebaseAuth } from 'react-hooks-firebase-auth';

const Component = () => {
return ;
};

export default withFirebaseAuth(Component);
```