@@ -23,7 +23,7 @@ needing to access a firebase instance created under a different store key.
2323_ Basic_
2424
2525``` javascript
26- // this. props.firebase set on App component as firebase object with helpers
26+ // props.firebase set on App component as firebase object with helpers
2727import { createFirebaseConnect } from ' react-redux-firebase'
2828// create firebase connect that uses another redux store
2929const firebaseConnect = createFirebaseConnect (' anotherStore' )
@@ -59,6 +59,7 @@ export default firebaseConnect()(App)
5959_ Ordered Data_
6060
6161``` javascript
62+ import React from ' react'
6263import { compose } from ' redux'
6364import { connect } from ' react-redux'
6465import { firebaseConnect } from ' react-redux-firebase'
@@ -72,37 +73,42 @@ const enhance = compose(
7273 })
7374)
7475
75- // use enhnace to pass todos list as props.todos
76- const Todos = enhance (({ todos })) =>
77- < div>
78- {JSON .stringify (todos, null , 2 )}
79- < / div>
80- )
76+ function Todos ({ todos }) {
77+ return (
78+ < div>
79+ {JSON .stringify (todos, null , 2 )}
80+ < / div>
81+ )
82+ }
8183
8284export default enhance (Todos)
8385` ` `
8486
8587_Data that depends on props_
8688
8789` ` ` javascript
90+ import React from ' react'
8891import { compose } from ' redux'
8992import { connect } from ' react-redux'
90- import { firebaseConnect , getVal } from ' react-redux-firebase'
93+ import { get } from ' lodash'
94+ import { firebaseConnect } from ' react-redux-firebase'
9195
9296const enhance = compose (
9397 firebaseConnect ((props ) => ([
9498 ` posts/${ props .postId } ` // sync /posts/postId from firebase into redux
9599 ]),
96100 connect ((state , props ) => ({
97- post: getVal (state .firebase .data , ` posts/ ${ props .postId } ` ),
101+ post: get (state .firebase .data , ` posts. ${ props .postId } ` ),
98102 })
99103)
100104
101- const Post = ({ post }) => (
102- < div>
103- {JSON .stringify (post, null , 2 )}
104- < / div>
105- )
105+ function Post ({ post }) {
106+ return (
107+ < div>
108+ {JSON .stringify (post, null , 2 )}
109+ < / div>
110+ )
111+ }
106112
107113export default enhance (Post)
108114` ` `
0 commit comments