<span className={styles.headerText3}>
<ReactToPrint
trigger={() =><Button
className={styles.buttonColor}
>
<AiOutlinePrinter />
</Button>}
content={() => this.componentRef}
/>
<Table1 ref={el => (this.componentRef = el)} />
我已经按照 react-to-print 中提到的方式尝试过这个,但是它在 this.componentRef 上抛出了错误。我正在使用打字稿,也许这就是问题所在。如何在 TS 上实现对打印的反应。