New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented createAppContainer() and createAuthContainer() #123
Conversation
Changes Unknown when pulling 1b48747 on jw-reactfire-2 into ** on jw-es6**. |
… JSON representation
Changes Unknown when pulling 225e3f4 on jw-reactfire-2 into ** on jw-es6**. |
1 similar comment
Changes Unknown when pulling 225e3f4 on jw-reactfire-2 into ** on jw-es6**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some notes, mostly nitpicks
"test": "gulp test", | ||
"travis": "gulp" | ||
"test": "npm run lint ; npm run build ; jest --coverage", | ||
"lint": "eslint src/ tests/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps we can use the node_modules/.bin/
binaries here so that they do not need global installation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They actually don't need a global install. I'm not sure if this is a newer npm thing, but anything with node_modules/.bin/
is addressable just by name in npm scripts.
|
||
let unsubscribe; | ||
|
||
class CreateAuthContainer extends React.Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It'd make more sense to me if this was just called AuthContainer, same goes for CreateAppContainer -> AppContainer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm conflicted and honestly not sure what the most correct thing to call this is. Let's chat about it in person tomorrow.
* | ||
* @return {boolean} Whether or not the provided input is a Firebase Database Reference. | ||
*/ | ||
export function isDatabaseReference(input) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't appear to be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be used in the next PR. If it's cool with you, I'll just keep it in this PR.
* @return {boolean} Whether or not the provided input is either a Firebase Database Reference or | ||
* a Firebase Database Query. | ||
*/ | ||
export function isDatabaseReferenceOrQuery(input) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, doesn't appear to be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto on the above.
LGTM |
Description
This implements two of the higher-order components that will make up ReactFire
2.0.0
:createAuthContainer()
andcreateAppContainer()
.createAuthContainer()
adds auser
prop to the provided component that is updated every time the auth state is changed. You can change the name of the prop by passing an optional second argumentcreateAppContainer()
adds afirebaseApp
prop to the provided component. Using this in addition withcreateAuthContainer()
allows you to listen for the auth state changes for the non-default Firebase app instance.Other miscellaneous changes:
gulp
withnpm
scripts.Code sample