-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
Added Disabled Prop and Styles to DropDownMenu #1406
Conversation
be843a0
to
bcaf95b
Compare
@@ -65,6 +66,7 @@ let DropDownMenu = React.createClass({ | |||
|
|||
getStyles(){ | |||
let zIndex = 5; // As AppBar | |||
let disabled = this.props.disabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand what const is, but not the purpose of your line note. Const is not used anywhere else in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mjhasbach Understood. We're trying to update our files with const
where appropriate and it looks like you happened to find a file we haven't touched yet. When accessing this.props
you should always write
// this.props is immutable within the context of this so we should treat it as such
const { style, children } = this.props;
if you are going to expand this.props
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure we're on the same page...
The purpose of disabled
is to make property value ternary evaluations of the object literal styles
more terse. Because this.props.disabled
is a React.PropTypes.bool
, mutating disabled
would not mutate this.props.disabled
.
Therefore, are you saying that disabled
should be declared with const
instead of let
to make it clear that disabled
should not be mutated (even though doing so would not mutate this.props
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More or less. It should be declared const
because disabled
is not and should probably not be mutated (yes because he come from a prop which is a source of truth).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. I made the requested change.
Added Disabled Prop and Styles to DropDownMenu
Thanks @mjhasbach @oliviertassinari ! |
Thanks! |
Fixes #1294