Skip to content

Commit e8db8ca

Browse files
committed
Docs added for constants. Examples added for most main functions.
1 parent 479af21 commit e8db8ca

18 files changed

+389
-269
lines changed

README.md

+16-13
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ View deployed version of [Material Example](https://github.com/prescottprue/reac
1919
## Features
2020
- Integrated into redux
2121
- Support for updating and nested props
22-
- [Population capability](https://prescottprue.gitbooks.io/react-redux-firebase/content/populate.html) (similar to mongoose's `populate` or SQL's `JOIN`)
22+
- [Population capability](http://react-redux-firebase.com/docs/populate.html) (similar to mongoose's `populate` or SQL's `JOIN`)
2323
- Out of the box support for authentication (with auto load user profile)
2424
- Firebase Storage Support
2525
- Support small data ( using `value` ) or large datasets ( using `child_added`, `child_removed`, `child_changed` )
@@ -179,8 +179,8 @@ export default connect(
179179

180180
```
181181

182-
## [API](https://prescottprue.gitbooks.io/react-redux-firebase/content/)
183-
See [API Docs](https://prescottprue.gitbooks.io/react-redux-firebase/content/)
182+
## [API](http://react-redux-firebase.com)
183+
See [react-redux-firebase.com](http://react-redux-firebase.com)
184184

185185
## [Examples](examples)
186186

@@ -200,7 +200,7 @@ A simple example that was created using [create-react-app](https://github.com/fa
200200

201201
#### [Material App Example](examples/complete/material)
202202

203-
An example that user Material UI built on top of the output of [create-react-app](https://github.com/facebookincubator/create-react-app)'s eject command. Shows a list of todo items and allows you to add to them. This is what is deployed to [react-redux-firebase.firebaseapp.com](https://react-redux-firebase.firebaseapp.com/).
203+
An example that user Material UI built on top of the output of [create-react-app](https://github.com/facebookincubator/create-react-app)'s eject command. Shows a list of todo items and allows you to add to them. This is what is deployed to [redux-firebasev3.firebaseapp.com](https://redux-firebasev3.firebaseapp.com/).
204204

205205
## Using with `redux-thunk`
206206
If you are using `redux-thunk`, make sure to set up your thunk middleware using it's redux-thunk's `withExtraArgument` method so that firebase is available within your actions. Here is an example `createStore` function that adds `getFirebase` as third argument along with a thunk that uses it:
@@ -214,15 +214,18 @@ import { reactReduxFirebase, getFirebase } from 'react-redux-firebase';
214214
import makeRootReducer from './reducers';
215215

216216
const fbConfig = {} // your firebase config
217-
217+
const config = {
218+
userProfile: 'users',
219+
enableLogging: false
220+
}
218221
const store = createStore(
219222
makeRootReducer(),
220223
initialState,
221224
compose(
222225
applyMiddleware([
223226
thunk.withExtraArgument(getFirebase) // Pass getFirebase function as extra argument
224227
]),
225-
reactReduxFirebase(fbConfig, { userProfile: 'users', enableLogging: false })
228+
reactReduxFirebase(fbConfig, )
226229
)
227230
);
228231

@@ -273,17 +276,17 @@ const somethingEpic = (action$, store, getFirebase) =>
273276
1. How is this different than [`redux-react-firebase`](https://github.com/tiberiuc/redux-react-firebase)?
274277

275278
This library was actually originally forked from redux-react-firebase, but adds extended functionality such as:
276-
* [populate functionality](https://prescottprue.gitbooks.io/react-redux-firebase/content/populate.html) (similar to mongoDB or SQL JOIN)
277-
* [`profileDecorator`](https://prescottprue.gitbooks.io/react-redux-firebase/content/config.html) - change format of profile stored on Firebase
278-
* [`getFirebase`](https://prescottprue.gitbooks.io/react-redux-firebase/content/thunks.html) - access to firebase instance that fires actions when methods are called
279-
* [integrations](https://prescottprue.gitbooks.io/react-redux-firebase/content/thunks.html) for [`redux-thunk`](https://github.com/gaearon/redux-thunk) and [`redux-observable`](https://redux-observable.js.org) - using `getFirebase`
280-
* [access to firebase's `storage`](https://prescottprue.gitbooks.io/react-redux-firebase/content/storage.html) method`
279+
* [populate functionality](http://react-redux-firebase.com/docs/populate.html) (similar to mongoDB or SQL JOIN)
280+
* [`profileDecorator`](http://react-redux-firebase.com/docs/config.html) - change format of profile stored on Firebase
281+
* [`getFirebase`](http://react-redux-firebase.com/docs/thunks.html) - access to firebase instance that fires actions when methods are called
282+
* [integrations](http://react-redux-firebase.com/docs/thunks.html) for [`redux-thunk`](https://github.com/gaearon/redux-thunk) and [`redux-observable`](https://redux-observable.js.org) - using `getFirebase`
283+
* [access to firebase's `storage`](http://react-redux-firebase.com/docs/storage.html) method`
281284
* `uniqueSet` method helper for only setting if location doesn't already exist
282285
* Object or String notation for paths (`[{ path: '/todos' }]` equivalent to `['/todos']`)
283-
* Action Types and other Constants are exposed for external usage (such as `redux-observable`)
286+
* Action Types and other Constants are exposed for external usage (such as with `redux-observable`)
284287

285288
#### Well why not combine?
286-
I have been talking to the author of [redux-react-firebase]() about combining, but we are not sure that the users of both want that at this point. Join us on [the redux-firebase gitter](https://gitter.im/redux-firebase/Lobby) if you haven't already since a ton of this type of discussion goes on there.
289+
I have been talking to the author of [redux-react-firebase](https://github.com/tiberiuc/redux-react-firebase) about combining, but we are not sure that the users of both want that at this point. Join us on [the redux-firebase gitter](https://gitter.im/redux-firebase/Lobby) if you haven't already since a ton of this type of discussion goes on there.
287290

288291
**Bottom line:** The author of redux-react-firebase was absent when functionality was needed by me and others, so this library was created.
289292

SUMMARY.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
# Summary
22

3-
* [Read Me](docs/README.md)
4-
* [Getting Started](docs/getting_started.md)
5-
* [Config](docs/config.md)
6-
* [Auth](docs/auth.md)
7-
* [Helpers](docs/helpers.md)
3+
* [Read Me](/README.md)
4+
* [Getting Started](/docs/getting_started.md)
5+
* [Auth](/docs/auth.md)
86
* [Queries](docs/queries.md)
97
* [Populate](docs/populate.md)
108
* [Storage](docs/storage.md)
119
* [Recipes](docs/recipes.md)
1210
* [Actions](docs/actions.md)
1311
* [Thunks](docs/thunks.md)
14-
* [Roadmap](docs/roadmap.md)
15-
* [Contributing](docs/contributing.md)
1612
* [API Reference](/docs/api/README.md)
13+
* [constants](/docs/api/constants.md)
1714
* [firebaseConnect](/docs/api/connect.md)
1815
* [firebaseStateReducer](/docs/api/reducer.md)
1916
* [reactReduxFirebase](/docs/api/compose.md)
2017
* [helpers](/docs/api/helpers.md)
18+
* [Roadmap](docs/roadmap.md)
19+
* [Contributing](docs/contributing.md)

bin/api-docs-generate.js

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ const files = [
1515
{
1616
src: 'reducer.js',
1717
dest: 'reducer.md'
18+
},
19+
{
20+
src: 'constants.js',
21+
dest: 'constants.md'
1822
}
1923
]
2024
const pathToDocumentationJs = 'node_modules/documentation/bin/documentation.js'

docs/README.md

+19-52
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,19 @@
1-
# React Redux Firebase
2-
3-
React Higher Order component library for Firebase with Redux integration
4-
5-
## Demo
6-
7-
View deployed version of Material Example [here](https://redux-firebasev3.firebaseapp.com/)
8-
9-
10-
## Features
11-
- Higher Order Component (HOC) for react
12-
- Integrated into redux
13-
- [Population](/populate.md) capability (similar to mongo `populate` or SQL `JOIN`)
14-
- Support small data ( using `value` ) or large datasets ( using `child_added`, `child_removed`, `child_changed` )
15-
- [queries support](/queries.md) ( `orderByChild`, `orderByKey`, `orderByValue`, `orderByPriority`, `limitToLast`, `limitToFirst`, `startAt`, `endAt`, `equalTo` right now )
16-
- Automatic binding/unbinding
17-
- Declarative decorator syntax for React components
18-
- Firebase v3+ support
19-
- Support for updating and nested props
20-
- Out of the box support for authentication (with auto load user profile)
21-
- Lots of helper functions
22-
23-
24-
## [Examples](examples)
25-
26-
#### [Simple Example](examples/simple)
27-
28-
A simple example that was created using [create-react-app](https://github.com/facebookincubator/create-react-app)'s. Shows a list of todo items and allows you to add to them.
29-
30-
#### [Decorators Example](examples/decorators)
31-
32-
The simple example implemented using decorators built from the output of [create-react-app](https://github.com/facebookincubator/create-react-app)'s eject command. Shows a list of todo items and allows you to add to them.
33-
34-
#### [Material Example](examples/material)
35-
36-
An example that user Material UI built on top of the output of [create-react-app](https://github.com/facebookincubator/create-react-app)'s eject command. Shows a list of todo items and allows you to add to them. This is what is deployed to [redux-firebasev3.firebaseapp.com](https://redux-firebasev3.firebaseapp.com/).
37-
38-
39-
## Generator
40-
41-
[generator-react-firebase](https://github.com/prescottprue/generator-react-firebase) uses react-redux-firebase when opting to include redux
42-
43-
## Contributors
44-
- [Prescott Prue](https://github.com/prescottprue)
45-
- [Tiberiu Craciun](https://github.com/tiberiuc)
46-
- [Bojhan](https://github.com/Bojhan)
47-
- [Rahav Lussto](https://github.com/RahavLussato)
48-
- [Justin Handley](https://github.com/justinhandley)
49-
50-
## Thanks
51-
52-
Special thanks to [Tiberiu Craciun](https://github.com/tiberiuc) for creating [redux-react-firebase](https://github.com/tiberiuc/redux-react-firebase), which this project is heavily based on.
1+
# Table of Contents
2+
3+
* [Read Me](/README.md)
4+
* [Getting Started](/docs/getting_started.md)
5+
* [Auth](/docs/auth.md)
6+
* [Queries](docs/queries.md)
7+
* [Populate](docs/populate.md)
8+
* [Storage](docs/storage.md)
9+
* [Recipes](docs/recipes.md)
10+
* [Actions](docs/actions.md)
11+
* [Thunks](docs/thunks.md)
12+
* [API Reference](/docs/api/README.md)
13+
* [constants](/docs/api/constants.md)
14+
* [firebaseConnect](/docs/api/connect.md)
15+
* [firebaseStateReducer](/docs/api/reducer.md)
16+
* [reactReduxFirebase](/docs/api/compose.md)
17+
* [helpers](/docs/api/helpers.md)
18+
* [Roadmap](docs/roadmap.md)
19+
* [Contributing](docs/contributing.md)

docs/SUMMARY.md

-16
This file was deleted.

docs/api/compose.md

+42-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,50 @@
22

33
# reactReduxFirebase
44

5-
Configuration call to be placed in compose call
5+
Middleware that handles configuration (placed in redux's `compose` call)
66

77
**Parameters**
88

99
- `fbConfig` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing Firebase config including databaseURL
10-
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object containing other config such as userProfile
10+
- `fbConfig.apiKey` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Firebase apiKey
11+
- `fbConfig.authDomain` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Firebase auth domain
12+
- `fbConfig.databaseURL` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Firebase database url
13+
- `fbConfig.storageBucket` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Firebase storage bucket
14+
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Containing react-redux-firebase specific config such as userProfile
15+
- `config.userProfile` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Location on firebase to store user profiles
16+
- `config.enableLogging` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Location on firebase to store user profiles. default: `false`
17+
- `config.profileDecorator` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Location on firebase to store user profiles. default: `false`
18+
- `config.updateProfileOnLogin` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not to update profile when logging in. default: `false`
19+
- `config.profileParamsToPopulate` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Whether or not to update profile when logging in. default: `false`
1120

12-
Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
21+
**Examples**
22+
23+
_Data_
24+
25+
```javascript
26+
import { createStore, compose } from 'redux'
27+
import { reactReduxFirebase } from 'react-redux-firebase'
28+
29+
// Firebase config
30+
const fbConfig = {
31+
apiKey: '<your-api-key>',
32+
authDomain: '<your-auth-domain>',
33+
databaseURL: '<your-database-url>',
34+
storageBucket: '<your-storage-bucket>'
35+
}
36+
37+
// React Redux Firebase Config
38+
const config = {
39+
userProfile: 'users'
40+
}
41+
42+
// Add react-redux-firebase to compose
43+
const createStoreWithFirebase = compose(
44+
reactReduxFirebase(fbConfig, config),
45+
)(createStore)
46+
47+
// Use Function later to create store
48+
const store = createStoreWithFirebase(rootReducer, initialState)
49+
```
50+
51+
Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** That accepts a component a returns a wrapped version of component

docs/api/connect.md

+45-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,48 @@ to provided firebase paths using React's Lifecycle hooks.
99

1010
- `watchArray` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** Array of objects or strings for paths to sync from Firebase
1111

12-
Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**
12+
**Examples**
13+
14+
_Basic_
15+
16+
```javascript
17+
// this.props.firebase set on App component as firebase object with helpers
18+
import { firebaseConnect } from 'react-redux-firebase'
19+
export default firebaseConnect()(App)
20+
```
21+
22+
_Paths_
23+
24+
```javascript
25+
import { connect } from 'react-redux'
26+
import { firebaseConnect, helpers } from 'react-redux-firebase'
27+
const { pathToJS } = helpers
28+
29+
const fbWrapped = firebaseConnect()(App)
30+
31+
// pass todos list from redux as this.props.todosList
32+
export default connect(({ firebase }) => ({
33+
profile: pathToJS(firebase, 'profile'),
34+
auth: pathToJS(firebase, 'auth')
35+
}))(fbWrapped)
36+
```
37+
38+
_Data_
39+
40+
```javascript
41+
import { connect } from 'react-redux'
42+
import { firebaseConnect, helpers } from 'react-redux-firebase'
43+
const { dataToJS } = helpers
44+
45+
// sync /todos from firebase into redux
46+
const fbWrapped = firebaseConnect([
47+
'todos'
48+
])(App)
49+
50+
// pass todos list from redux as this.props.todosList
51+
export default connect(({ firebase }) => ({
52+
todosList: dataToJS(firebase, 'todos')
53+
}))(fbWrapped)
54+
```
55+
56+
Returns **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** that accepts a component to wrap and returns the wrapped component

docs/api/constants.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
2+
3+
# actionsPrefix
4+
5+
Prefix for all actions within library
6+
7+
**Examples**
8+
9+
```javascript
10+
import { constants } from 'react-redux-firebase'
11+
constants.actionsPrefix === '@@reactReduxFirebase' // true
12+
```
13+
14+
# defaultJWTKeys
15+
16+
Default keys returned within JSON Web Token recieved when authenticating
17+
18+
**Examples**
19+
20+
```javascript
21+
import { constants } from 'react-redux-firebase'
22+
constants.defaultJWTKeys // list of default JWT keys from Firebase
23+
```
24+
25+
# actionTypes
26+
27+
Object containing all action types
28+
29+
**Examples**
30+
31+
```javascript
32+
import { actionTypes } from 'react-redux-firebase'
33+
actionTypes.SET === '@@reactReduxFirebase/SET' // true
34+
```
35+
36+
```javascript
37+
import { constants } from 'react-redux-firebase'
38+
constants.actionTypes.SET === '@@reactReduxFirebase/SET' // true
39+
```
40+
41+
# supportedAuthProviders
42+
43+
List of all external auth providers that are supported (firebase's email/anonymous included by default)
44+
45+
**Examples**
46+
47+
```javascript
48+
import { constants } from 'react-redux-firebase'
49+
constants.supportedAuthProviders // list of supportedAuthProviders
50+
```

0 commit comments

Comments
 (0)