-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Howdy,
Thanks for the library - it's very useful. It would be more useful, though, if it didn't have decorators, because getting them to work is a pain.
I ended up pulling out the hoc - withFirestore and using auto-bind as follows:
import React, { Component } from 'react'
import autoBind from 'auto-bind'
import { FirestoreContext } from 'react-firebase-context'
const withFirestore = WrappedComponent => {
return class extends Component {
constructor(props) {
super(props)
autoBind.react(this)
}
render() {
return (
<FirestoreContext.Consumer>
{({ firestore, data, query }) => {
firestore.data = data
firestore.query = query
return <WrappedComponent firestore={firestore} {...this.props} />
}}
</FirestoreContext.Consumer>
)
}
}
}
export default withFirestore
and then using it as follows:
export default withFirestore(MyClass)
Metadata
Metadata
Assignees
Labels
No labels