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
Closed

Any better way to get refs in ReactTransitionGroup? #8734

techctu opened this issue Jan 10, 2017 · 1 comment

Comments

@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
Copy link
Collaborator

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants