React-redux-firebase: Subscribe to path with param

Created on 12 Jan 2017  路  6Comments  路  Source: prescottprue/react-redux-firebase

Hi! The component thta firebaseConnect is returning is receiving via props an id
Then, it must subscribe to 'items/${ownProps.id}'
How can I achieve this? since the paths you pass to firebaseConnect are an array and not obtained with a function

question

Most helpful comment

I believe this may be what you are looking for:
``js @firebaseConnect((props) => ([ items/${props.id}`
]))

All 6 comments

If firebaseConnect accepted a function, we could pass the props into this function and make this function return an array of paths
This concept is used on redux's connect function. mapStateToProps and mapDispatchToProps are both functions that accept the ownProps as a parameter

I believe this may be what you are looking for:
``js @firebaseConnect((props) => ([ items/${props.id}`
]))

Yeah, that's also what I was proposing. Is it on the documentation?
Sorry!

There is a bit about it on the connect page of the docs but I will look for other places to make it even more clear.

@prescottprue Did you manage to write about this question? Cos I've tried to search for the solution, but it doesn't work at all.

The state based query example shows a query that is dynamic (I believe what you are looking for).

Was this page helpful?
0 / 5 - 0 ratings