I am browsing the reactfire github and they use mixins.
I thought they were deprecated? Am I behind the times?
You can't easily hoist the state used by mixin up into the parent component. Unlike components, mixins don't lend themselves naturally to such changes. Every new requirement makes the mixins harder to understand. Components using the same mixin become increasingly coupled with time.
But they weren't designed to solve the problem like Mixins had been. And Mixins and Hooks are surprisingly similar. Let's look at the Hooks implementation again. The usePlayers Hook and the PlayersMixins are pretty similar.
The mixins option accepted an array of objects containing methods and properties to be applied to the class. However, React mixins are no longer supported with classes defined with ES6+ syntax. React has distanced itself from its own mixins solution in favor of higher-order components (HOC).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With