<commit_before># `v1.*.*` to `v2.*.*` Migration Guide

### What Changed
* No more immutable JS which means:
  * no need for `pathToJS` and `dataToJS` ([`getVal` added](#getval) for easy transition)
  * simplified population (can easily be done manually following common redux patterns)
  * [`redux-persist`](https://github.com/rt2zz/redux-persist) is supported out of the box
* Simplified population through `populate` (instead of `populatedDataToJS`)
* Firebase instance must be passed as first argument instead of config vars:
  * removes platform specific code while improving platform support
  * allows any version of Firebase to be used
  * allows [`react-native-firebase`](https://github.com/invertase/react-native-firebase) to be passed (for using native modules instead of JS within `react-native`)
  * firebase is no longer a dependency (shrinks umd bundle size)
* Auth state works differently - `{ isLoaded: false, isEmpty: false }` is the initialState instead of `undefined` - means updates to routing HOCs and other code using auth state (see [Routing Section below](#routing))
* `firebaseConnect` now passes `state` as second argument if function is passed. `store.firebase` is now third argument instead of second (see [state based query secont](#stateBasedQueries) below)
* `profileParamsToPopulate` does not automatically populate profile, populated version can be loaded with `populate` (there will most likely be an option to enable auto populating before `v2.0.0` is out of pre-release)
* Firestore is supported (setup shown below)
* `LOGOUT` is no longer dispatched on empty auth state changes (`enableEmptyAuthChanges: true` can be passed to dispatch `AUTH_EMPTY_CHANGE` action in its place)
* `enableEmptyAuthChanges` is no longer an option, it has been replaced by `preserveOnEmptyAuthChange` (see [empty auth](#emptyAuth) below)

### Pass In Firebase instance

If you would like to instantiate a Firebase instance outside of `react-redux-firebase`, you can pass it in as the first argument like so:

**`v1.*.*`**

```js
import { compose, createStore } from 'redux'
import { reactReduxFirebase } from 'react-redux-firebase'
const fbConfig = {} // object containing Firebase config
const rrfConfig = { userProfile: 'users' } // react-redux-firebase config

const store = createStore(
 reducer,
 initialState,
 compose(
   reactReduxFirebase(fbConfig, rrfConfig), // pass in firebase instance instead of config
   applyMiddleware(...middleware)
 )
)
```

**`v2.*.*`**

* Pass Firebase Instance in place of
* `firebaseReducer` is now available to use in place of `firebaseStateReducer` (which is still available)

```js
import { createStore, combineReducers, compose } from 'redux'
import { reactReduxFirebase, firebaseReducer } from 'react-redux-firebase'
import firebase from 'firebase'
// import 'firebase/firestore' // <- needed if using firestore

const fbConfig = {} // object containing Firebase config
const rrfConfig = { userProfile: 'users' } // react-redux-firebase config

// initialize firebase instance
firebase.initializeApp(config) // <- new to v2.*.*
// firebase.firestore() // <- needed if using firestore

// Add Firebase to reducers
const rootReducer = combineReducers({
  firebase: firebaseReducer,
  // firestore: firestoreReducer // <- needed if using firestore
})

const store = createStore(
 rootReducer,
 initialState,
 compose(
   reactReduxFirebase(firebase, rrfConfig), // pass in firebase instance instead of config
   // reduxFirestore(firebase) // <- needed if using firestore
  //  applyMiddleware(...middleware) // to add other middleware
 )
)
```<commit_msg>fix(docs): cleanup typo with fbConfig parameter - @jenglamlow<commit_after># `v1.*.*` to `v2.*.*` Migration Guide

### What Changed
* No more immutable JS which means:
  * no need for `pathToJS` and `dataToJS` ([`getVal` added](#getval) for easy transition)
  * simplified population (can easily be done manually following common redux patterns)
  * [`redux-persist`](https://github.com/rt2zz/redux-persist) is supported out of the box
* Simplified population through `populate` (instead of `populatedDataToJS`)
* Firebase instance must be passed as first argument instead of config vars:
  * removes platform specific code while improving platform support
  * allows any version of Firebase to be used
  * allows [`react-native-firebase`](https://github.com/invertase/react-native-firebase) to be passed (for using native modules instead of JS within `react-native`)
  * firebase is no longer a dependency (shrinks umd bundle size)
* Auth state works differently - `{ isLoaded: false, isEmpty: false }` is the initialState instead of `undefined` - means updates to routing HOCs and other code using auth state (see [Routing Section below](#routing))
* `firebaseConnect` now passes `state` as second argument if function is passed. `store.firebase` is now third argument instead of second (see [state based query secont](#stateBasedQueries) below)
* `profileParamsToPopulate` does not automatically populate profile, populated version can be loaded with `populate` (there will most likely be an option to enable auto populating before `v2.0.0` is out of pre-release)
* Firestore is supported (setup shown below)
* `LOGOUT` is no longer dispatched on empty auth state changes (`enableEmptyAuthChanges: true` can be passed to dispatch `AUTH_EMPTY_CHANGE` action in its place)
* `enableEmptyAuthChanges` is no longer an option, it has been replaced by `preserveOnEmptyAuthChange` (see [empty auth](#emptyAuth) below)

### Pass In Firebase instance

If you would like to instantiate a Firebase instance outside of `react-redux-firebase`, you can pass it in as the first argument like so:

**`v1.*.*`**

```js
import { compose, createStore } from 'redux'
import { reactReduxFirebase } from 'react-redux-firebase'
const fbConfig = {} // object containing Firebase config
const rrfConfig = { userProfile: 'users' } // react-redux-firebase config

const store = createStore(
 reducer,
 initialState,
 compose(
   reactReduxFirebase(fbConfig, rrfConfig), // pass in firebase instance instead of config
   applyMiddleware(...middleware)
 )
)
```

**`v2.*.*`**

* Pass Firebase Instance in place of
* `firebaseReducer` is now available to use in place of `firebaseStateReducer` (which is still available)

```js
import { createStore, combineReducers, compose } from 'redux'
import { reactReduxFirebase, firebaseReducer } from 'react-redux-firebase'
import firebase from 'firebase'
// import 'firebase/firestore' // <- needed if using firestore

const fbConfig = {} // object containing Firebase config
const rrfConfig = { userProfile: 'users' } // react-redux-firebase config

// initialize firebase instance
firebase.initializeApp(fbConfig) // <- new to v2.*.*
// firebase.firestore() // <- needed if using firestore

// Add Firebase to reducers
const rootReducer = combineReducers({
  firebase: firebaseReducer,
  // firestore: firestoreReducer // <- needed if using firestore
})

const store = createStore(
 rootReducer,
 initialState,
 compose(
   reactReduxFirebase(firebase, rrfConfig), // pass in firebase instance instead of config
   // reduxFirestore(firebase) // <- needed if using firestore
  //  applyMiddleware(...middleware) // to add other middleware
 )
)
```
{'fraction_non_alphanumeric': 0.10043968123110744, 'fraction_numerical': 0.00247320692497939, 'mean_word_length': 4.754150197628459, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4907598', 'n_tokens_mistral': 2113, 'n_tokens_neox': 2035, 'n_words': 812}