diff --git a/.gitignore b/.gitignore
index 5d31eeb..8bc1a7c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,6 @@ npm-debug.log
# Testing output
.nyc_output
coverage
+
+#test files
+/example
diff --git a/auth/README.md b/auth/README.md
index de06f8b..b5c5d3e 100644
--- a/auth/README.md
+++ b/auth/README.md
@@ -11,6 +11,8 @@ import { useAuthState } from 'react-firebase-hooks/auth';
List of Auth hooks:
- [useAuthState](#useauthstate)
+- [useRegister](#useregister)
+- [useLogin](#uselogin)
### useAuthState
@@ -30,6 +32,8 @@ Returns:
- `loading`: A `boolean` to indicate whether the the authentication state is still being loaded
- `error`: Any `firebase.auth.Error` returned by Firebase when trying to load the user, or `undefined` if there is no error
+#### If you are registering or logingIn the user for the first time consider using [useRegister](#useregister), [useLogin](#uselogin)
+
#### Full Example
```js
@@ -70,3 +74,121 @@ const CurrentUser = () => {
return ;
};
```
+
+### useRegister
+
+```js
+const [registeredUser, error, register, loading] = useRegister( auth, email, password );
+```
+
+Import statement :
+
+```js
+import { useRegister } from 'react-firebase-hooks/auth';
+```
+
+For full full example [check here](#register-and-login-hook-usage)
+
+Register a user and receive the user credentials
+
+The `useRegister` hook takes the following parameters:
+
+- `auth`: `firebase.auth.Auth` instance for the app you would like to monitor
+- `email`: `string` email of the user
+- `password`: `string` password of the user
+
+Returns:
+
+- `registeredUser`: The `registeredUser` if data is received or `undefined` if not
+- `loading`: A `boolean` to indicate whether the the registration is completed or it's yet processing
+- `error`: `any` returned by Firebase when trying to register the user, or `undefined` if there is no error
+- `register`: `void` a function you can call to start the registration
+
+### useLogin
+
+```js
+const [loggedInUser, error, login, loading] = useLogin(auth, email, password);
+```
+
+Import statement :
+
+```js
+import { useLogin } from 'react-firebase-hooks/auth';
+```
+
+For full full example [check here](#register-and-login-hook-usage)
+
+Register a user and receive the user credentials
+
+The `useLogin` hook takes the following parameters:
+
+- `auth`: `firebase.auth.Auth` instance for the app you would like to monitor
+- `email`: `string` email of the user
+- `password`: `string` password of the user
+
+Returns:
+
+- `loggedInUser`: The `loggedInUser` if data is received or `undefined` if not
+- `loading`: A `boolean` to indicate whether the the login process is completed or it's yet processing
+- `error`: `any` returned by Firebase when trying to register the user, or `undefined` if there is no error
+- `login`: `void` a function you can call to start the login process
+
+## Register and Login hook usage
+
+```jsx
+import React, { useState } from 'react';
+import { auth } from './firebase';
+import { useLogin, useRegister } from 'react-firebase-hooks/auth';
+
+function App() {
+ const [email, setEmail] = useState('');
+ const [password, setPassword] = useState('');
+ const [loggedInUser, error, login, loading] = useLogin(auth, email, password);
+ const [registeredUser, error, register, loading] = useRegister(auth, email, password);
+
+ // Use only one of the above two hooks in one file
+
+ if (error) {
+ return (
+