Skip to content

Commit 68b2488

Browse files
author
Scott Prue
committed
fix(docs): add note about getFirebase not being part of v3 api
1 parent 9a1586a commit 68b2488

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

README.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ import 'firebase/auth'
5656
// import 'firebase/firestore' // <- needed if using firestore
5757
// import 'firebase/functions' // <- needed if using httpsCallable
5858
import { createStore, combineReducers, compose } from 'redux'
59-
import { ReactReduxFirebaseProvider, firebaseReducer } from 'react-redux-firebase'
59+
import ReactReduxFirebaseProvider from 'react-redux-firebase/lib/ReactReduxFirebaseProvider'
60+
import firebaseReducer from 'react-redux-firebase/lib/reducer'
6061
// import { createFirestoreInstance, firestoreReducer } from 'redux-firestore' // <- needed if using firestore
6162

6263
const fbConfig = {}
@@ -92,13 +93,15 @@ const rrfProps = {
9293
}
9394

9495
// Setup react-redux so that connect HOC can be used
95-
const App = () => (
96-
<Provider store={store}>
97-
<ReactReduxFirebaseProvider {...rrfProps}>
98-
<Todos />
99-
</ReactReduxFirebaseProvider>
100-
</Provider>
101-
);
96+
function App() {
97+
return (
98+
<Provider store={store}>
99+
<ReactReduxFirebaseProvider {...rrfProps}>
100+
<Todos />
101+
</ReactReduxFirebaseProvider>
102+
</Provider>
103+
);
104+
}
102105

103106
render(<App/>, document.getElementById('root'));
104107
```
@@ -110,7 +113,7 @@ The Firebase instance can then be grabbed from context within your components (`
110113
```jsx
111114
import React from 'react'
112115
import PropTypes from 'prop-types'
113-
import { withFirebase } from 'react-redux-firebase'
116+
import withFirebase from 'react-redux-firebase/lib/withFirebase'
114117
import { compose, withHandlers } from 'recompose'
115118

116119
function Todos({ firebase, addSampleTodo }) {
@@ -144,7 +147,8 @@ import React from 'react'
144147
import PropTypes from 'prop-types'
145148
import { connect } from 'react-redux'
146149
import { compose } from 'redux'
147-
import { firebaseConnect, isLoaded, isEmpty } from 'react-redux-firebase'
150+
import firebaseConnect from 'react-redux-firebase/lib/firebaseConnect'
151+
import { isLoaded, isEmpty } from 'react-redux-firebase/lib/helpers'
148152

149153
function Todos({ todos, firebase }) {
150154
if (!isLoaded(todos)) {
@@ -187,7 +191,8 @@ It is common to make a detail page that loads a single item instead of a whole l
187191
import React from 'react'
188192
import PropTypes from 'prop-types'
189193
import { connect } from 'react-redux'
190-
import { firebaseConnect, getVal } from 'react-redux-firebase'
194+
import { get } from 'lodash'
195+
import firebaseConnect from 'react-redux-firebase/lib/firebaseConnect'
191196
import { compose, withHandlers } from 'recompose'
192197

193198
// Component enhancer that loads todo into redux then into the todo prop
@@ -385,7 +390,7 @@ This project exists thanks to all the people who contribute.
385390

386391
Thank you to all our backers! 🙏
387392

388-
* [Reside Network Inc.](https://github.com/reside-eng)
393+
* [Side Inc.](https://github.com/reside-eng)
389394

390395
[npm-image]: https://img.shields.io/npm/v/react-redux-firebase.svg?style=flat-square
391396
[npm-url]: https://npmjs.org/package/react-redux-firebase

docs/v3-migration-guide.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* Support `react-redux` v6 and new React Context API - [#581](https://github.com/prescottprue/react-redux-firebase/issues/581). This mean no more `reactReduxFirebase` and `reduxFirestore` store enhancers (instance is passed through the new React context API) - [#581](https://github.com/prescottprue/react-redux-firebase/issues/581)
66
* `componentDidMount` used in place of `componentWillMount` for data loading
7+
* `getFirebase` no longer part of the API
78

89
### Remove Store Enhancer
910

@@ -14,15 +15,15 @@ Replace store enhancer with `ReactReduxFirebaseProvider`
1415
_RTDB Diff_
1516
```diff
1617
+ import { ReactReduxFirebaseProvider } from 'react-redux-firebase'
17-
- import { reactReduxFirebase } from 'react-redux-firebase'
18+
- import { reactReduxFirebase, getFirebase } from 'react-redux-firebase'
1819

1920
const store = createStore(
2021
rootReducer,
2122
initialState,
22-
compose(
23+
- compose(
2324
- reactReduxFirebase(firebase, rrfConfig), // pass in firebase instance instead of config
24-
// applyMiddleware(...middleware) // to add other middleware
25-
)
25+
- applyMiddleware([ thunk.withExtraArgument(getFirebase) ]) // to add other middleware
26+
- )
2627
)
2728

2829
+ const rrfProps = {
@@ -151,7 +152,6 @@ export default combineReducers({
151152
})
152153
```
153154

154-
155155
`createReduxStore.js`
156156
```js
157157
import { createStore } from 'redux'

0 commit comments

Comments
 (0)