-
Notifications
You must be signed in to change notification settings - Fork 47.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't call prototype method of a mixin #2243
Comments
You need a factory to return an object with props and methods to be use. Dont instantiate a function because this isn't scoped directly.... bad code? |
@cigzigwon as described above this is what I have already and it works, it just is a little less memory efficient than using a prototype if many instances are created. I don't know why you say "bad code", since when using a prototype is bad code? This may be considered as a premature optimisation, but I think it would be either nice to support mixins with prototypes, or either document that we can't use prototypes with mixins. On the IRC chan I was not alone wondering if it works or not, and I guess some other people will give it a try to prototypes |
@slorber React cannot use the prototype as it auto-binds all methods, this will eventually (in 0.13 it seems) be a non-issue as you will then provide classes to React. React will no longer require the use of |
Closing as we have classes now |
I have a "mixin factory" creating mixins with many helper methods that vary in a single attribute, so I wanted to create a mixin with prototype to save some memory, but it seems I can't call prototypal methods.
Check this sample:
http://jsfiddle.net/smmyxz2s/1/
with
<div>Hello {this.blabla}</div>;
it returns the appropriate result but not with<div>Hello {this.getBlabla()}</div>;
Is it possible to implement?
The text was updated successfully, but these errors were encountered: