You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above install command will install the `@latest` tag. You may also use the following tags when installing to get different versions:
47
47
48
-
*`@next` - Next upcoming release. currently points to active progress with `v1.5.0-*` pre-releases
48
+
*`@next` - Next upcoming release. Currently points to active progress with `v1.5.0-*` pre-releases
49
49
*`@canary` - Most possible up to date code. Currently points to active progress with `v2.0.0-*` pre-releases. *Warning:* Syntax is different than current stable version.
50
50
51
51
Other versions docs are available using the dropdown on the above docs link. For quick access:
**Note:**Be aware of changes when using version that are tagged `@latest`. Please report any issues you encounter, and try to keep an eye on the [releases page](https://github.com/prescottprue/react-redux-firebase/releases) for relevant release info.
55
+
Be aware of changes when using version that are tagged `@latest`. Please report any issues you encounter, and try to keep an eye on the [releases page](https://github.com/prescottprue/react-redux-firebase/releases) for updates.
56
56
57
57
## Use
58
58
59
-
**NOTE:** If you are just starting a new project, you might want to use [`v2.0.0`](http://docs.react-redux-firebase.com/history/v2.0.0/#use) has an even easier syntax. For clarity on the transition, view the [`v1` -> `v2` migration guide](http://docs.react-redux-firebase.com/history/v2.0.0/docs/v2-migration-guide.html)
59
+
**Note:** If you are just starting a new project, you may want to use [`v2.0.0`](http://docs.react-redux-firebase.com/history/v2.0.0/#use) since it is has an even easier syntax. For clarity on the transition, view the [`v1` -> `v2` migration guide](http://docs.react-redux-firebase.com/history/v2.0.0/docs/v2-migration-guide.html)
60
60
61
61
Include `reactReduxFirebase` in your store compose function and `firebaseStateReducer` in your reducers:
62
62
@@ -277,7 +277,7 @@ The [examples folder](/examples) contains full applications that can be copied/a
277
277
*[populate functionality](http://react-redux-firebase.com/docs/populate) (similar to mongoDB or SQL JOIN)
278
278
*`react-native` support ([web/js](http://react-redux-firebase.com/docs/recipes/react-native.html) or native modules through [`react-native-firebase`](http://docs.react-redux-firebase.com/history/v2.0.0/docs/recipes/react-native.html#native-modules))
279
279
* tons of [integrations](#integrations)
280
-
*[`profileDecorator`](http://react-redux-firebase.com/docs/config) - change format of profile stored on Firebase
280
+
*[`profileFactory`](http://react-redux-firebase.com/docs/config) - change format of profile stored on Firebase
281
281
*[`getFirebase`](http://react-redux-firebase.com/docs/thunks) - access to firebase instance that fires actions when methods are called
282
282
*[access to firebase's `storage`](http://react-redux-firebase.com/docs/storage) method`
283
283
*`uniqueSet` method helper for only setting if location doesn't already exist
Copy file name to clipboardExpand all lines: docs/populate.md
+55-34Lines changed: 55 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,36 +2,62 @@
2
2
3
3
Populate allows you to replace IDs within your data with other data from Firebase. This is very useful when trying to keep your data flat. Some would call it a _join_, but it was modeled after [the mongo populate method](http://mongoosejs.com/docs/populate.html).
4
4
5
+
Initial data from populate is placed into redux in a normalized pattern [following defined redux practice of normalizing](http://redux.js.org/docs/recipes/reducers/NormalizingStateShape.html). `populatedDataToJS` helper used in the `connect` function then builds populated data out of normalized data within redux (**NOTE:** This does not apply if you are using `v1.1.5` or earlier).
6
+
7
+
A basic implementation can look like so:
8
+
```javascript
9
+
constpopulates= [
10
+
{ child:'owner', root:'users' } // replace owner with user object
11
+
]
12
+
13
+
@firebaseConnect([
14
+
// passing populates parameter also creates all necessary child queries
15
+
{ path:'todos', populates }
16
+
])
17
+
@connect(({ firebase }) => ({
18
+
// populate original from data within separate paths redux
// dataToJS(firebase, 'todos') for unpopulated todos
21
+
}))
22
+
```
23
+
24
+
## Some Things To Note
25
+
26
+
* Population happens in two parts:
27
+
1.`firebaseConnect` - based on populate settings, queries are created for associated keys to be replaced. Query results are stored in redux under the value of `root` in the populate settings.
28
+
2.`connect` - Combine original data at path with all populate data (in redux from queries created by passing populate settings to `firebaseConnect`)
29
+
* Populate creates a query for each key that is being replaced
30
+
* Results of populate queries are placed under their root
31
+
32
+
## Examples
33
+
5
34
List of todo items where todo item can contain an owner parameter which is a user's UID like so:
6
35
7
36
```json
8
-
{ text: 'Some Todo Item', owner: "Iq5b0qK2NtgggT6U3bU6iZRGyma2" }
37
+
{ "text": "Some Todo Item", "owner": "Iq5b0qK2NtgggT6U3bU6iZRGyma2" }
9
38
```
10
39
11
-
Populate allows you to replace the owner parameter with another value on Firebase under that key. That value you can be a string \(number and boolean treated as string\), or an object
12
-
13
-
Initial data from populate is placed into redux in a normalized pattern [following defined redux practice of normalizing](http://redux.js.org/docs/recipes/reducers/NormalizingStateShape.html). `populatedDataToJS` helper used in the `connect` function then builds populated data out of normalized data within redux (**NOTE:** This does not apply if you are using `v1.1.5` or earlier).
0 commit comments