0.3.2 • Published 5 years ago

@use-firebase/database v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@use-firebase/database

A custom React Hook that impliments Firebase's Database object.

npm version All Contributors

Installation

$ 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.

API

useValue

For now, here is a basic setup. This will likely change in the future.

const [value, setValue] = useValue(path);

Parameters

Here are the parameters that you can use.

ParameterDescription
pathA string path to the value in Firebase.

Return

useValue returns a useState compatible array that you can deconstruct into value and setValue.

ParameterDescription
valueThe 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.
setValueA 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).

Example

TODO

Live demo

TODO

License

MIT Licensed

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago