-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
[added] onClick handler to <Link /> #178
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
Conversation
modules/components/Link.js
Outdated
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 think the code is pretty clear here, no need for the comment :)
@spicyj thumbs up? |
modules/components/Link.js
Outdated
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.
do we need to check if this exists first? Or maybe provide a default noop function?
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.
This might be a little clearer as:
var ret = this.props.onClick(event);
// `false` prevents default; `undefined` does not
if (ret === false) {
allowTransition = false;
}
and then just if (allowTransition)
at the bottom; it wasn't clear to me on a first reading why you were comparing to false down there.
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 did the same thing, actually. 👍
Updated! Thanks for the feedback; should be a bit cleaner now |
can you squash and force push? would be nice to be just one commit |
sure, done |
[added] onClick handler to <Link />
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.
um, defaultPrevented?
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.
/facepalm I should have caught that
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.
See #173 for previous discussion.