Table of Contents


Redux store enhancer that accepts configuration options and adds store.firebase and store.firebaseAuth. Enhancers are most commonly placed in redux's compose call along side applyMiddleware.


  • firebaseInstance Object Initiated firebase instance (can also be library following Firebase JS API such as react-native-firebase)
  • config Object Containing react-redux-firebase specific configuration
    • config.userProfile String Location on firebase to store user profiles
    • config.enableLogging Boolean Whether or not to enable Firebase database logging. Note: Only works if instance has enableLogging function.
    • config.profileFactory Function Factory for modifying how user profile is saved.
    • config.presence Boolean Location on Firebase to store currently online users list. Often set to 'presence' or 'onlineUsers'.
    • config.sessions Boolean Location on Firebase where user sessions are stored (only if presense is set). Often set to 'sessions' or 'onlineUsers'.
    • config.updateProfileOnLogin Boolean Whether or not to update profile when logging in. (default: true)
    • config.resetBeforeLogin Boolean Whether or not to empty profile and auth state on login
    • config.preserveOnLogout (Object | Array) Data parameters to preserve when logging out. If Array is passed, each item represents keys within to preserve. If an object is passed, keys associate with slices of state to preserve, and the values can be either an Array or a Function (argument pattern: (currentState, nextState)). If passing an array of keys (i.e. { auth: ['key1', 'key2'] }) - those keys ('key1' and 'key2') are preserved from that slice of state (auth). If passing a function (i.e. { auth: (currentAuthState, nextAuthState) => ({}) }), whatever is returned from the function is set to that slice of state (auth). associate with which keys to preserve form that section of state. (default: null)
    • config.preserveOnEmptyAuthChange Object null Data parameters to preserve when logging out. Keys associate with parts of state to preserve, and the values are Arrays contain keys for keys within that slice of state to preserve.
    • config.useFirestoreForProfile Boolean false Write profile data to Firestore instead of Real Time Database.
    • config.useFirestoreForStorageMeta Boolean false Write storage file metadata to Firestore instead of Real Time Database.
    • config.enableRedirectHandling Boolean Whether or not to enable auth redirect handling listener. (default: true)
    • config.onAuthStateChanged Function Function run when auth state changes. Argument Pattern: (authData, firebase, dispatch)
    • config.onRedirectResult Function Function run when redirect result is returned. Argument Pattern: (authData, firebase, dispatch)
    • config.customAuthParameters Object Object for setting which customAuthParameters are passed to external auth providers.
    • config.profileFactory Function Factory for modifying how user profile is saved.
    • config.fileMetadataFactory Function Factory for modifying how file meta data is written during file uploads
    • config.profileParamsToPopulate (Array | String) Parameters within profile object to populate. As of v2.0.0 data is only loaded for population, not actually automatically populated (allows access to both unpopulated and populated profile data).
    • config.autoPopulateProfile Boolean NOTE: Now enabled for v2.0.0. Whether or not to automatically populate profile with data loaded through profileParamsToPopulate config. (default: true)
    • config.setProfilePopulateResults Boolean Whether or not to call SET actions for data that results from populating profile to redux under the data path. For example role parameter on profile populated from 'roles' root. True will call SET_PROFILE as well as a SET action with the role that is loaded (places it in data/roles). (default: false)



import { createStore, compose } from 'redux'
import { reactReduxFirebase } from 'react-redux-firebase'
import * as firebase from 'firebase'

// React Redux Firebase Config
const config = {
  userProfile: 'users', // saves user profiles to '/users' on Firebase
  // here is where you place other config options

// initialize script from Firebase page
const fbConfg = {} // firebase config object

// Add react-redux-firebase to compose
// Note: In full projects this will often be within createStore.js or store.js
const createStoreWithFirebase = compose(
 reactReduxFirebase(firebase, config),

// Use Function later to create store
const store = createStoreWithFirebase(rootReducer, initialState)

Returns Function That accepts a component and returns a Component which wraps the provided component (higher order component).

results matching ""

    No results matching ""