Recompose: How can I access the ref of the BaseComponent or any level of the components?

Created on 17 Aug 2016  路  13Comments  路  Source: acdlite/recompose

All 13 comments

@stupidisum Would you mind to create a question on StackOverflow and use recompose tag? Because it is easier for other people to find and answer your question. Thanks in advance!

I tried to ask a question in stackoverflow.
Here is the situation.

class BaseComponent {
    doSth(){...}
}
const Component compose(...some)(BaseComponent);

class App {
    componentDidMount() {
        // undefined(doSth) is not a function
        this.refs.component.doSth();
    }
    render() {
        <Component ref="component" />
   }
}

But I got the error...

Creating the new tag 'recompose' requires at least 1500 reputation. Try something from the existing tags list instead.

@stupidisum Oops, would you mind to use react tag temporarily?

Is this still valid? I can create it :)

@montogeek It would be great! Thanks in advance.

Thank you very much!

Ok, the only way to create a tag is by asking a question, I am going to post this question

As a note from: http://stackoverflow.com/help/privileges/create-tags :

However, note that:

on some sites, new tags will be automatically culled and removed from the system if they are not > used by at least 1 other question in a 6 month period.
meta tags, tags that cannot stand alone as the only tag on a question, are not allowed.

Thank you again for creating the question.

@montogeek Thanks a lot!

@stupidisum I have answered the question on the StackOverflow. I am going to close this issue. Please feel free to reopen it if you have further questions.

239

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rndmerle picture rndmerle  路  3Comments

robbporto picture robbporto  路  3Comments

nemocurcic picture nemocurcic  路  3Comments

astanciu picture astanciu  路  3Comments

xialvjun picture xialvjun  路  4Comments