4
原始問題:https://github.com/acdlite/recompose/issues/232如何訪問BaseComponent的引用或任何級別的組件?
我該如何訪問BaseComponent的ref或任何級別的組件?
代碼:
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" />
}
}