Skip to content
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

Don't show initialRating on props suggestion and show Value prop instead #108

Open
sayedsaeedhosseini opened this issue Sep 9, 2018 · 4 comments

Comments

@sayedsaeedhosseini
Copy link

On 1.3.2 version
Why don't show "initialRating" prop on props suggestion and what is the "value" prop on props suggestion shows instead?

@dreyescat
Copy link
Owner

Hey @sayedsaeedhosseini!

I am a bit lost... What do you mean? What is props suggestion? Do you mean to change initialRating prop name to value?

@aepp
Copy link

aepp commented Feb 18, 2019

+1
@dreyescat
I think @sayedsaeedhosseini means exactly what you said - value would be a better name, since it's not only "initial" rating that is specified by this property, but a rather a value wich changes during user interaction, so it's not "initial" any more but rather "updated" or "changed", so just value would be better.

@sayedsaeedhosseini
Copy link
Author

Hey @sayedsaeedhosseini!

I am a bit lost... What do you mean? What is props suggestion? Do you mean to change initialRating prop name to value?

@dreyescat Thanks for your comment. I work with Webstorm and when I import and use your component on my code, I get prop suggestion (It show me your component's props as a suggestion to use them) but dont suggest me "initialRating" prop and show me "value" as a prop and it doesnt work when I use it.
Is it a bug or It`s my suggestion extension wrong?

@dreyescat
Copy link
Owner

@aepp
Well... Yes and no.
No because technically the initialRating prop is used to initialize the value state during the initial rendering. Once the rating element is rendered the value can be changed clicking on any symbol independently of what the initial value was. You can see this as the react defaultValue. But I prefer initial instead of default 😉. Let's say this is a sort of uncontrolled component.
Yes, because when you use it as a controlled component (i.e., when you take over the value state) initialValue prop and value state become the same. You are constantly overwriting the value state with the intialValue.
This is why I think initialValue is better than value. Buy I understand it is just a matter of semantic 😃 .

@sayedsaeedhosseini
I don't use and have never used Webstorm so far. I know that we use an internal component (not the public layer) that has a value prop. Maybe the extension is mixing this internal component properties with the public component ones showing you the union of both component properties. Then, if you select the value prop it is just ignored because the public component does not have this property. Just guessing... 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants