Skip to content

bartkoedijk/react-native-firebase-hooks

Repository files navigation

React Native Firebase Hooks

A set of reusable React Hooks for Firebase.

This is the React Native version that uses the typings of @react-native-firebase package. To use Firebase hooks with the Firebase JS SDK go to: react-firebase-hooks

npm version npm downloads

Installation

React Native Firebase Hooks requires react 16.8.0 or later and @react-native-firebase/app v12.0.0 or later.

Official support for Hooks was added to React Native in v0.59.0. React Native Firebase Hooks works best for React Native that uses the @react-native-firebase package. This package also works for when using Firebase JS SDK (v8.0.0+) although it could give type definition errors.

# with npm
npm install --save react-native-firebase-hooks

# with yarn
yarn add react-native-firebase-hooks

This assumes that you’re using the npm or yarn package managers with a module bundler like Webpack or Browserify to consume CommonJS modules.

Why?

There has been a lot of hype around React Hooks, but this hype merely reflects that there are obvious real world benefits of Hooks to React developers everywhere.

This library explores how React Hooks can work to make integration with Firebase even more straightforward than it already is. It takes inspiration for naming from RxFire and is based on an internal library that we had been using in a number of apps prior to the release of React Hooks. The implementation with hooks is 10x simpler than our previous implementation.

Documentation

License