-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Backbone/jQuery style alternative notation for setState/setProps #2189
Comments
i actually think it makes it less readable, because you need to ask yourself if you see something like this: |
Old issue: #175 I've come to believe that it's better left this way. You've got one way to do things and Somewhat related: with immutable collections, it'll probably be |
Thanks for finding that @chenglou. There was also #282 where somebody made this work. I think at this point, we're going to wontfix it again. I do understand the desire but I also think an explicitly (and consistently) typed API is more readable and usable long term than something more polymorphic like this. This is the direction we've tried to move with our code and I think we'll stick with it. There hasn't been a strong need for this and it's really only people making the transition from Backbone that have even asked. But if we do add this, I think we'll want to do it with its own API, not reuse |
Being able to do
this.setState('key', value, callback);
when you're only changing a single item would make things a little more readable in my opinion. Thoughts?When the title says Backbone/jQuery style notation I'm referring to
$('#target').css('color', 'red')
being an alternative to$ '#target').css({color: red})
in jQuery andmodel.set('key', value)
being an alternative tomodel.set({key: value})
in BackboneThe text was updated successfully, but these errors were encountered: