FormidableLabs / radium

A toolchain for React component styling.
http://formidable.com/open-source/radium/
MIT License
7.39k stars 308 forks source link

Radium.getState documentation and signature #475

Open hgezim opened 8 years ago

hgezim commented 8 years ago

I just don't understand what the second argument in getState is supposed to be: Radium.getState(state, elementKey, value).

Also, since it's optional wouldn't it be better to have it as the last argument here?

ianobermiller commented 8 years ago

Yes, value is not a good name. Maybe stateName would be better? There is more documentation in the API docs, did you already refer to this? https://github.com/FormidableLabs/radium/tree/master/docs/api#getstate

This part is also confusing, should be reworded:

elementKey - if you used multiple elements, pass the same key="" or ref="". If you only have one element, you can leave it blank ('main' will be inferred)

How about:

elementKey - if you are styling multiple elements in a single component, you have to specify a unique identifier in the ref or key prop. To access the state of that element, pass the same unique key