Redux bindings for Firebase
MIT License
Redux bindings for Firebase
Provide Framework/library agnostic Firebase bindings for redux similar to those available in react-redux-firebase
and other similar libraries.
populate
or SQL's JOIN
)value
) or large datasets ( using child_added
, child_removed
, child_changed
)orderByChild
, orderByKey
, orderByValue
, orderByPriority
, limitToLast
, limitToFirst
, startAt
, endAt
, equalTo
right now )redux-thunk
and redux-observable
redux-observable
)react-native
support using native modules or web sdk
npm install --save redux-firebase
Note: If you are just starting a new project, you may want to use v2.0.0
since it is has an even easier syntax. For clarity on the transition, view the v1
-> v2
migration guide
Include reactReduxFirebase
in your store compose function and firebaseStateReducer
in your reducers:
import { createStore, combineReducers, compose } from 'redux'
import { reduxFirebase, firebaseReducer } from 'react-redux-firebase'
import * as firebase from 'firebase'
// Add Firebase to reducers
const rootReducer = combineReducers({
firebase: firebaseReducer
})
// Firebase config
const config = {
apiKey: '<your-api-key>',
authDomain: '<your-auth-domain>',
databaseURL: '<your-database-url>',
storageBucket: '<your-storage-bucket>'
}
const rfConfig = { userProfile: 'users' } // react-redux-firebase config
// initialize firebase instance
firebase.initializeApp(config) // <- new to v2.*.*
// Add reduxReduxFirebase to compose
const createStoreWithFirebase = compose(
reduxFirebase(firebase, rfConfig), // firebase instance as first argument
)(createStore)
// Create store with reducers and initial state
const store = createStoreWithFirebase(rootReducer, initialState)
Join us on the redux-firebase gitter.
react-redux-firebase
?The future plan for is for react-redux-firebase
to be powered by this library. redux-firebase
will contain the redux specific internal logic which was originally created for react-redux-firebase
. In this way, redux-firebase
is front end framework agnostic,