-
Notifications
You must be signed in to change notification settings - Fork 46.7k
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
setState (and others) parameters format #175
Comments
Are you using the minified React package or unminified? |
minified, 0.3.3 |
Can you try with unminified? You should get a more helpful error message. If not, we have a bug. |
OK so that error message still sucks, but at least you're getting messages in the correct build. Thanks for the report! |
@jordwalke will have some thoughts on this, since the proposed API doesn't support GCC key crushing, or whatever. I could go either way.. this API is more convenient and prevents an object allocation in the simple case (and it's familiar), but it also makes this function a bit more flexible, and I'm typically from the "constraints are liberating" camp. |
Just to clarify @tomocchino, I brought this habit over from Backbone and other libraries. I'm also in the same camp as you, and accepting this format was a mere idea. I'd much prefer a simple error message in the line of |
I would like to see
I don't know if that (having two sets of arguments in a function) is acceptable style for React, but it is definitely used quite a bit in JS world. If that's acceptable, then another problem arises - how do I document that so that it renders nicely in documentation? |
Based on our lack of movement on this and some of the discussion in the associated PR, I'm going to wontfix this. If it comes up again though I'm open for discussing further. |
Assign timeoutID to avoid multiple requests
Currently accidentally using
this.setState('title', 'Car')
throws an unhelpfulMERGE_CORE_FAILURE
error. Would be nice to either throw a better error or accept this format.Same goes for
setProps
, etc.The text was updated successfully, but these errors were encountered: