Skip to content

Version v2.0.0 Alpha

Pre-release
Pre-release
Compare
Choose a tag to compare
@prescottprue prescottprue released this 21 Jun 05:05
  • 🎉 NO MORE IMMUTABLE.JS! 🎉 which means:
    • no more using pathToJS, dataToJS, or customToJS - see snippets below
    • simplified population (can easily be done manually following common redux patterns)
    • redux-persist is supported out of the box (no longer need dataToJS, pathToJS, or customToJS)
  • New Population syntax (populate instead of populatedDataToJS) - see snippets below
  • Firebase instance can be passed as first argument instead of config vars (see snippets below):
    • removes platform specific code while improving platform support
    • allows any version of Firebase to be used
    • allows react-native-firebase to be passed (for using native modules instead of JS within react-native)
  • Wrapping instance with helpers which internally dispatch redux actions separated into exported function named createFirebaseInstance
  • Material example uses new syntax (no helpers)
  • react-native example passes in an instantiated instance of Firebase

Migration Guide

Syntax Snippets

  • No more helpers:

    import { connect } from 'react-redux'
    import { firebaseConnect } from 'react-redux-firebase';
    
    @firebaseConnect(['todos'])
    @connect(
      ({ firebase: { auth, data: { todos }} }) => ({
        todos, // v1 would require dataToJS
        auth, // v1 would require pathToJS
      })
    )
  • Passing A Firebase Instance:

    import * as firebase from 'firebase/app'
    import 'firebase/auth'
    import 'firebase/database'
    import 'firebase/storage'
    
    const fbConfig = {} // object containing Firebase config
    firebase.initializeApp(fbConfig)
    
    const store = createStore(
      reducer,
      initialState,
      compose(
        reactReduxFirebase(firebase, reduxConfig),
        applyMiddleware(...middleware),
        ...enhancers
      )
    )
  • new populate syntax:

    import { connect } from 'react-redux'
    import { firebaseConnect, populate } from 'react-redux-firebase'
    
    const populates = [
      { child: 'owner', root: 'users' }
    ]
    
    @firebaseConnect([
      { path: 'todos', populates }
      // '/todos#populate=owner:users', // equivalent string notation
     ])
    @connect(
      ({ firebase }) => ({
        todos: populate(firebase, 'todos', populates), // used to be populatedDataToJS
      })
    )