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

Optionally disable wrappedInstance ref #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Aesthetikx
Copy link

Addresses #30, inspired by react-redux/2d3d0beade5

Defaults to true to maintain compatibility.

@LINKIWI
Copy link

LINKIWI commented Jan 1, 2017

Are there any plans to merge this? cc @digidem

return (
<div style={wrapperStyle} ref='wrapper'>
{(containerWidth || containerHeight) &&
<ComposedComponent
{...this.state}
{...this.props}
updateDimensions={this.updateDimensions}
ref='wrappedInstance'
ref={ref}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be condensed to ref={withRef && 'wrappedInstance'}

Stateless components cannot use refs, so this adds the withRef option
(enabled by default for compatibility) which enables or disables passing
the wrappedInstance ref to the wrapped component. Addresses issue digidem#30.
Inspired by reduxjs/react-redux@2d3d0be
@Aesthetikx
Copy link
Author

@LINKIWI 👍

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

Successfully merging this pull request may close these issues.

2 participants