-
Notifications
You must be signed in to change notification settings - Fork 48.6k
Setters not preserved with React.createClass #6023
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
Comments
Probably not in a remotely performant way. Performance of module initialization (which directly influences initial load time) would be fatal. http://jsperf.com/sdfewfgwasd/2 Going to close this out, because... it's an edge case that people rarely hit, I don't think we can support it in a performant way, and the workaround is to use ES6 classes. Feel free to continue the discussion on this thread. We can re-open / re-examine if our thinking on this matter changes dramatically. That said, I am curious to hear about your use case. What are you trying to do? |
Ah ok thanks guys, performance I see, and even through mixins it's not possible?, I didn't manage as well. @jimfb I'm doing an html 'wysiwyg' editor, and for a few components, it's a bit dirty because they should be updated by many different events (selectionchange, keydown, mousedown), quite frequently (even if throttled). So sometimes I choose to update the position of popovers (div overlays) manually rather, with vanilla js, and put less things in state, sometimes even nothing. (Another example of where I can't use react is this http://jsfiddle.net/crl/ckvstvrk/36/ react is too slow for these sort of things) I could do something like http://jsfiddle.net/crl/fu06rxw8/6/ but it's not important after all, thanks |
setters in
React.createClass
are ignored http://jsfiddle.net/crl/fu06rxw8/3,but they work with class syntax http://jsfiddle.net/crl/fu06rxw8/4/
Wouldn't it be possible to create the component class from the object given and preserve any setters/getters?
The text was updated successfully, but these errors were encountered: