-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Fix the withRef mess #3740
Fix the withRef mess #3740
Conversation
57184e5
to
b11c1fd
Compare
Beat you to it :P |
There were a few more things to clean up in the test code, including how e.g. https://github.com/reactjs/react-router/blob/master/modules/__tests__/withRouter-test.js#L77-L78 calls I'll rebase and merge. |
|
||
function getDisplayName(WrappedComponent) { | ||
return WrappedComponent.displayName || WrappedComponent.name || 'Component' | ||
} | ||
|
||
export default function withRouter(WrappedComponent, options) { | ||
const { withRef } = options || {} |
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'd rather do destructuring in case the options grow. If they won't ever (I dunno, maybe?) then this should just be a simple boolean arg.
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 figure deal with that when we get there, and for now skip creating an empty object that doesn't get any use.
Updated to simplify the render branch a bit |
Gah okay tests should actually pass now |
Cleans up code style, variable naming, and tests