# easy-firebase-react-hooks

Latest version **1.0.12** (published 2020-12-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install easy-firebase-react-hooks
pnpm add easy-firebase-react-hooks
yarn add easy-firebase-react-hooks
bun add easy-firebase-react-hooks
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.12 |
| Published | 2020-12-18 |
| First published | 2020-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 19.1 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Esmat Nawahda |
| Maintainers | esmatnawahda |
| Keywords | firebase, hooks, hooks-firebase, react-firebase, react, react-hooks, react-hooks-firebase, easy-firebase-react-hooks |

## Links

- npm: https://www.npmjs.com/package/easy-firebase-react-hooks
- Repository: https://github.com/esmat-nawahda/easy-firebase-react-hooks
- Homepage: https://github.com/esmat-nawahda/easy-firebase-react-hooks#readme
- Issues: https://github.com/esmat-nawahda/easy-firebase-react-hooks/issues
- npm.io page: https://npm.io/package/easy-firebase-react-hooks

## Dependencies (6)

- [uuid](https://npm.io/package/uuid.md) ^8.3.1
- [react](https://npm.io/package/react.md) 16.13.1
- [firebase](https://npm.io/package/firebase.md) 7.23.0
- [react-dom](https://npm.io/package/react-dom.md) 16.13.1
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [@firebase/app](https://npm.io/package/@firebase/app.md) ^0.6.11

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.12 (latest) — 2020-12-18
- 1.0.11 — 2020-11-03
- 1.0.10 — 2020-11-03
- 1.0.9 — 2020-11-03
- 1.0.8 — 2020-10-28
- 1.0.7 — 2020-10-28
- 1.0.6 — 2020-10-28
- 1.0.5 — 2020-10-28
- 1.0.4 — 2020-10-26
- 1.0.3 — 2020-10-26
- 1.0.2 — 2020-10-26
- 1.0.1 — 2020-10-26
- 1.0.0 — 2020-10-26

## README

# easy-firebase-react-hooks


[A full example for FirebaseHooks.useRTDatabaseList & FirebaseHooks.useRTDatabaseValue ⚡️]

```node
import React from "react";
import firebase from "firebase";
import FirebaseHooks from "easy-firebase-react-hooks";

// Firebase Config, this is for showing our example only
// Add your firebase config and init it in different file
const config = {
  apiKey: "",
  authDomain: "",
  databaseURL: "",
  projectId: "",
  storageBucket: "",
  messagingSenderId: "",
  appId: "",
  measurementId: ""
};

if (!firebase.apps.length) {
  firebase.initializeApp(config);
}


// Example starts here
export default function App() {
  const [
    allData,
    pageData,
    total,
    loading,
    error,
    numberOfPages,
    page,
    prevPage,
    nextPage,
    visitPage,
    addRecord
  ] = FirebaseHooks.useRTDatabaseList(
    "conversations/5f6df949e3b8b00960ce371a/messages",
    3
  );
  const [rtValue, setValue] = FirebaseHooks.useRTDatabaseValue(
    "/conversations/5f6df949e3b8b00960ce371a/createdAt"
  );

  const addItemToList = () => {
    addRecord({
      createdAt: firebase.database.ServerValue.TIMESTAMP,
      testKey: "TEST TEST TEST"
    });
  };

  const setRTValue = () => {
    setValue({
      testKey: "TEST TEST TEST"
    });
  };

  return (
    <div>
      <h1>
        Hello Firebase Hooks ({page}/{numberOfPages})
      </h1>
      <button onClick={prevPage}>PREV</button>
      <button onClick={nextPage}>NEXT</button>
      <button onClick={() => visitPage(7)}>Go to page</button>
      <button onClick={() => addItemToList()}>Add record</button>
      {loading ? <div>Loading...</div> : <p>{JSON.stringify(pageData)}</p>}
      <hr />
      <h3>{rtValue}</h3>
      <button onClick={() => setRTValue()}>Set record</button>
    </div>
  );
}
```

---
_Source: https://npm.io/package/easy-firebase-react-hooks · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
