Skip to content

Instantly share code, notes, and snippets.

@dsafreno
Created October 16, 2019 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsafreno/8ecd7a4da30a86905c040b238914b417 to your computer and use it in GitHub Desktop.
Save dsafreno/8ecd7a4da30a86905c040b238914b417 to your computer and use it in GitHub Desktop.
Firebase RTDB Component - withDbData
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