“Unfortunately ES6 launched without any mixin support. Therefore, there is no support for mixins when you use React with ES6 classes. Instead, we’re working on making it easier to support such use cases without resorting to mixins.”
Mixins are going away. They still work with the .createClass method of creating components but most people now are moving to ES2015 classes or the even newer functional/stateless components. Container components should be used now using createContainer in core:
Instead of using getMeteorData on your component, you instead create a container component which is reactive and can pass data down via props. It also allows you to keep all your data fetching away from your presentational component.
That’s right. You need a container for your container.
If you’re using Redux you can use react-reduxs connect() to create a container to your createContainer container… if that makes sense. So your components will be like:
BTW if you don’t want to use Redux, you could just create a ReactiveVar and sync your Redux store into there, then just read from that var in your component? Although I just came up with that idea 15 seconds ago so I don’t know what the implications are.
Bump on this. What is the recommended way to create a component, reactive to data, without using mix-ins? The guide’s react-meteor-data has a mix-in as a dependency unfortunately (unless I am missing something?).
Thanks to anyone who can point me in the right direction!
There is no problem with having mixins in a library implementation. Dan Abramov is warning against heavily using mixins in your app code, because that gets confusing. I think createContainer meets the requirements.