A custom React Hook that impliments Firebase's Database object.
$ npm i @use-firebase/database
or
$ yarn add @use-firebase/database
Currently only useValue
for a single database ref is supported.
Complete support is planned.
For now, here is a basic setup. This will likely change in the future.
const [value, setValue] = useValue(path);
Here are the parameters that you can use.
Parameter | Description |
---|---|
path |
A string path to the value in Firebase. |
useValue
returns a useState
compatible array that you can deconstruct into value
and setValue
.
Parameter | Description |
---|---|
value |
The value from the Firebase database at path . If the path is invalid, or the data is not yet read from thje cloud, a null is returned. |
setValue |
A function that accepts a single patameter that is the data sent to Firebase. It returns a promise that resolves when the data is saved in the cloud. value will immediately reflect the new value from calling setValue (i.e. no round trip required to see a new value ). |
TODO
TODO
MIT Licensed