Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reactfire, aren't mixins deprecated?

I am browsing the reactfire github and they use mixins.

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

like image 493
omgj Avatar asked May 26 '16 05:05

omgj


People also ask

Why not to use mixins?

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.

Which react hook is similar to using mixins?

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.

How do you use mixins in react JS?

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).


1 Answers

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.

like image 171
Alberto Schiabel Avatar answered Sep 22 '22 18:09

Alberto Schiabel