5

I am browsing the reactfire github and they use mixins.

I thought they were deprecated? Am I behind the times?

omgj
  • 1,369
  • 3
  • 12
  • 18
  • I don't think they are deprecated, they just aren't supported with ES6/ES2015 classes. https://facebook.github.io/react/docs/reusable-components.html#mixins – ctrlplusb May 26 '16 at 06:26
  • Yes, don't use react-fire. just bind a listener to a firebase ref and update state when the data changes. – Blair Anderson May 26 '16 at 17:27
  • Would I do something like this: `componentWillMount() { firebaseRef.then(response => this.setState({ data: response })); }` ? – omgj May 27 '16 at 03:52

2 Answers2

8

You might want to take a look to this brief answer: https://www.quora.com/Is-it-possible-to-use-Firebase-with-ES6-on-React

The problem with ReactFire is because it uses Mixins, it's not compatible with ES6 classes. After chatting with Jacob Turner, we wanted to create a way to allow the one way binding of ReactFire with ES6 classes along some more features like two way data binding and listening to Firebase endpoints without actually binding a state property to them. Thus, re-base was built.

So, here's a Relay inspired library for building React.js + Firebase applications: https://github.com/tylermcginnis/re-base

This was helpful to me, I hope it'll be the same with you.

Alberto Schiabel
  • 1,049
  • 10
  • 23
0

Apart from re-base, also have a look at react-redux-firebase as mentioned in this reactfire discussion:

react-redux-firebase

Redux bindings for Firebase. Includes Higher Order Component for use with React.

Tom Söderlund
  • 4,743
  • 4
  • 45
  • 67