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

Any better way to get refs in ReactTransitionGroup? #8734

Closed
techctu opened this Issue Jan 10, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@techctu
Copy link

techctu commented Jan 10, 2017

I've found I can get children's refs in ReactTransitionGroup. Just like

<TransitionGroup ref={(ref) => this._refs = ref}>
    <div>Hello</div>
</TransitionGroup>

Then I can get <div>Hello</div> by this._refs.refs['.$.0']

It's quite ugly.

Is there any better way?

@gaearon

This comment has been minimized.

Copy link
Member

gaearon commented Jan 10, 2017

This is an implementation detail and is not officially supported. As far as I know there is currently no better way (you could also get a top-level ref and then use DOM API to get a child).

We could work around it by switching to callback refs internally. However we don't plan to change the TransitionGroup code anymore in this repository. We've been moving it to https://github.com/reactjs/react-transition-group so please file new feature requests and bug reports there. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.