@@ -111,7 +111,7 @@ export const createFirebaseConnect = (storeKey = 'store') => (
111111 * // props.firebase set on App component as firebase object with helpers
112112 * import { firebaseConnect } from 'react-redux-firebase'
113113 * export default firebaseConnect()(App)
114- * @example <caption>Data</caption>
114+ * @example <caption>Ordered Data</caption>
115115 * import { compose } from 'redux'
116116 * import { connect } from 'react-redux'
117117 * import { firebaseConnect } from 'react-redux-firebase'
@@ -124,47 +124,35 @@ export const createFirebaseConnect = (storeKey = 'store') => (
124124 * todos: state.firebase.ordered.todos
125125 * })
126126 * )
127+ *
127128 * // use enhnace to pass todos list as props.todos
128129 * const Todos = enhance(({ todos })) =>
129130 * <div>
130131 * {JSON.stringify(todos, null, 2)}
131132 * </div>
132133 * )
134+ *
135+ * export default enhance(Todos)
133136 * @example <caption>Data that depends on props</caption>
134137 * import { compose } from 'redux'
135138 * import { connect } from 'react-redux'
136- * import { firebaseConnect } from 'react-redux-firebase'
139+ * import { firebaseConnect, getVal } from 'react-redux-firebase'
137140 *
138141 * const enhance = compose(
139142 * firebaseConnect((props) => ([
140143 * `posts/${props.postId}` // sync /posts/postId from firebase into redux
141144 * ]),
142- * connect(({ firebase: { data } } , props) => ({
143- * todo: data.posts && data.todos[ postId] ,
145+ * connect((state , props) => ({
146+ * post: getVal(state.firebase. data, `posts/${props. postId}`) ,
144147 * })
145148 * )
146149 *
147- * const Posts = ({ done, text, author }) => (
148- * <article>
149- * <h1>{title}</h1>
150- * <h2>By {author.name}</h2>
151- * <div>{content}</div>
152- * </article>
150+ * const Post = ({ post }) => (
151+ * <div>
152+ * {JSON.stringify(post, null, 2)}
153+ * </div>
153154 * )
154155 *
155- * export default enhance(Posts)
156- * @example <caption>Data that depends on state</caption>
157- * import { compose } from 'redux'
158- * import { connect } from 'react-redux'
159- * import { firebaseConnect } from 'react-redux-firebase'
160- *
161- * export default compose(
162- * firebaseConnect((props, store) => ([
163- * `todos/${store.getState().firebase.auth.uid}`
164- * ]),
165- * connect(({ firebase: { data, auth } }) => ({
166- * todosList: data.todos && data.todos[auth.uid],
167- * }))
168- * )(SomeComponent)
156+ * export default enhance(Post)
169157 */
170158export default createFirebaseConnect ( )
0 commit comments