我的父组件有多个组件,如下所示
class DashboardPage extends Component {
render() {
const { classes } = this.props;
return (
<div>
<ReactToPrint
className={classes.content}
trigger={() => <a href="#">Print this out!</a>}
content={() => this.componentRef}
/>
<Card>
<ProfileHeader {...this.state}/>
<ContentLeft {...this.state}/>
<ContentRight {...this.state}/>
<ContentLeft1 {...this.state}/>
<ContentRight1 {...this.state}/>
<ProjectTopic {...this.state}/>
<ProjectContent {...this.state}/>
<ProjectTopic1 {...this.state}/>
<ProjectContent1 {...this.state}/>
<ProjectTopic2 {...this.state}/>
<ProjectContent2 {...this.state}/>
</Card>
</div>
);
}
}
如果我想打印一个组件,我可以使用下面的代码
<ComponentToPrint ref={el => (this.componentRef = el)} />
如何使用卡片标签内的内容以便打印每个组件
请帮我处理这个IM新手