Usage without mixins
See original GitHub issueWhen using ES Classes and/or TypeScript, it is not the best approach to use mixins. I know is possible, using class XYZ extends Component.extend(Mixin) { ...
but it would be nice to not have an alternative to using mixins.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
mixin and @include - Sass
Mixins allow you to define styles that can be re-used throughout your stylesheet. ... Keyword arguments use the same syntax as variable declarations...
Read more >Use without mixins · Issue #1619 · mainmatter/ember-simple ...
Is there a plan for allowing consumption of ember-simple-auth in a codebase that bans or restricts use of mixins?
Read more >You Shouldn't be Using Mixins in Vue.js Anymore
Mixins are a way of reusing a functionality between components by merging the properties of a mixin with the component. It allows us...
Read more >How to use Mixins in LESS, a CSS Preprocessor - SitePoint
LESS is a CSS Preprocessor. In this article we look at Mixins and other programming language like functionality that it holds.
Read more >Mixins Considered Harmful – React Blog
Let's make it clear that mixins are not technically deprecated. If you use React.createClass() , you may keep using them.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looking at the mixins in question, it doesn’t seem all that difficult for those who want a more explicit “composition instead of inheritance” option.
Example:
https://github.com/bgentry/ember-apollo-client/blob/5296032ff0b10ac3bd9bebf6cca8f56946c90929/addon/mixins/route-query-manager.js#L5-L8
99% of the complexity in this addon lives on the service, which is excellent. It’s very much true that a Router/Component/Object has an object that provides apollo support rather than being an object that includes apollo support.
If you don’t want to use the
RouteQueryManager
mixin, just inject theservice:apollo
yourself, and add the appropriate one-liners to your route (or a route base class).For a first-class TS/ES6 approach, looks like the work would be:
this._super(...arguments);
but that could change. Tests would alert us to that change.I implemented
queryManager
macro on my fork if some of you are interested in trying it out and give feedback. cc @buschtoenshttps://github.com/tchak/ember-apollo-client/tree/drop-mixins