Skip to content

Need help to send component reference #280

@maitedev

Description

@maitedev

Hi, I am trying to use the react-to-print library in my application but without satisfactory results so far. I don't know how I should send the reference to the ReactToPrint component, I appreciate any suggestions. Grateful in advance.
Note: the component I want to print is the FormContent of type class .

    <Paper>
      <Grid container direction="column" spacing={1}>
        <Grid item xs={12}>
          <Grid container direction="row">
            <Grid item xs={6}>
              <FormTopLeft />
            </Grid>
            <Grid item xs={6}>
              <ReactToPrint
                trigger={() => (
                  <Tooltip title="Print">
                    <IconButton>
                      <PrintIcon />
                    </IconButton>
                  </Tooltip>
                )}
                content={() => this.componentRef}
              />
            </Grid>
          </Grid>
          <Divider/>
        </Grid>
        <Grid item xs={12}>
          <FormContent ref={el => (this.componentRef = el)} />
        </Grid>
      </Grid>
    </Paper>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions