Created
October 16, 2019 19:16
-
-
Save dsafreno/8ecd7a4da30a86905c040b238914b417 to your computer and use it in GitHub Desktop.
Firebase RTDB Component - withDbData
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Example extends React.Component { | |
componentDidMount() { | |
// first time we got data! | |
} | |
render() { | |
let {user, team} = this.props; | |
// don't need to null check since we await the data! | |
} | |
} | |
const USER_SPEC = { | |
name: 'user', | |
template: 'users/{userId}', | |
await: true | |
}; | |
const TEAM_SPEC = { | |
name: 'team', | |
template: 'teams/{teamId}', | |
await: true | |
}; | |
export default withDbData([USER_SPEC, TEAM_SPEC])(Example) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment