你能告诉我为什么这个高阶组件无效。我正在尝试使用HOC
显示按钮和标签。这是我的代码
http://codepen.io/anon/pen/ygpVeZ
var D = (comp) => class extends React.Component{
render (){
return (<comp/>)
}
}
class A extends React.Component {
render(){
return (
<button>hrllo</button>
)
}
}
class B extends React.Component {
render(){
return (
<label> hello</label>
)
}
}
const PP =D(B)
const PPP =D(A)
class C extends React.Component {
render(){
return (
<div>
<PP></PP>
<PPP></PPP>
</div>
)
}
}
ReactDOM.render(<C/>,document.getElementById('root'))