我想构建一个辅助基本组件,该组件将执行以下操作:
// BaseComponent.jsx
@inject('facade')
@observer
class BaseComponent extends React.Component {
get facade() {
return this.props.facade
}
}
export default BaseComponent
// SomeComponent.jsx
class SomeComponent extends BaseComponent {
render() {
return this.facade.someProperty
}
}
export default SomeComponent
以上代码无效,并产生can't read someProperty of undefined
有什么想法怎么做?
谢谢!