如何在打字稿中使用反应打印

时间:2021-04-02 21:42:40

标签: reactjs typescript react-to-print

          <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 上实现对打印的反应。

0 个答案:

没有答案