-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Unable to access refs when using compose with Redux connect and Radium #475
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
Comments
In AddItem.js, you'll have to do: const enhance = compose(
connect(mapStateToProps, null, null, { withRef: true }),
Radium
); and then in Items.js do: addItem.getWrappedInstance().refs['selector'].focus(); |
Your solution works perfectly. Thanks @jimbolla ! |
Have another example with issue:
const withData = compose(
graphql(HEARING_LESSONS_QUERY, {
props: mapProps,
options,
withRef: true
}),
injectIntl
)
export default withData(HearingLessons)
<HearingLessons
ref={el => {
if (!!el) {
this._hearingLessons = el.getWrappedInstance()
}
}}
/> The problem
PS. the part |
This comment has been minimized.
This comment has been minimized.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Problem
React component is unable to access refs in a second React component that uses Redux
compose
to combine Reduxconnect
andRadium
.In the example below,
setFocus
in Items.js cannot accessaddItem.refs
when AddItem.js is composed with Reduxconnect
andRadium
.However, when I comment out
connect(mapStateToProps)
in AddItem.js (as shown below), thenaddItem.refs['selector'].focus();
is able to access refs and works as expected.Environment
react: 15.0.2
react-redux: 4.4.5
redux: 3.5.2
radium: 0.18.1
Items.js
ItemRow.js
AddItem.js
The text was updated successfully, but these errors were encountered: