Closed Domiii closed 7 years ago
DataToJS is not related to /data path on firebase, its just a way to get snapshot.val() directly, if you need to iterate over your snapshot by some order you did with query you'll not use that and do snapshot.foreach, if not its nicer to get the data directly.
@RahavLussato It specifically states in the API description (and it is an accurate description of the code):
dataToJS(immutableData, pathAsString, notSetValue)
Short for pathToJS(immutableData,
data/${pathAsString}
, notSetValue)
It is the same as pathToJS
but restricted to the /data
path. So I am wondering: What is the significance of the /data
path? Why did it deserve hard-coding? What are the conventions?
Sorry for not being clear earlier! :)
The /data that mentioned is related to the internal state of redux where the data is stored not to the path of firebase
@Domiii can @tiberiuc close this ?
Ok thank you.
From the beginning this confused me a bit: For some reason, this library (and I think I also saw it in other libraries) gave special significance to the
/data
path, specifically by offering thedataToJS
convenience helper function. From what I understand, the/data
path has no special significance to Firebase per se, so, if I am not utterly wrong, this is based on some sort of convention, isn't it?Seeing how your library gives special attention to the
/data
path, references to documents which propose the convention of structuring your data in Firebase like this would be greatly appreciated, not sure if you or anyone else could provide those?(Slightly off-topic: In general, any sort of list of resources and conventions that help new-comers better structure their data right from the start, would love to hear about it :) )