如何将用户特征(姓名、部门等)添加到我的 const 变量中?

How can i add user features(name, department etc.) into my const variable in react?

我想从我的用户信息页面制作一个 pdf 文件。我使用 react-pdf,但我没有在 react-pdf 网页的文档变量中找到有关使用 props 的信息。可以用吗,或者不用道具怎么办?

const MyDoc = () => (
<Document>
  <Page size="A4" style={styles.page}>
    <View style={styles.section}>
    <Header as="h5" dividing color="teal" content="User Info" />
       Please contact with your manager
        <Table id="pdf">
          <Table.Body>
            <Table.Row>
              <Table.Cell><Header as='h4'>Name</Header></Table.Cell>
              <Table.Cell>{this.props.user.profile.name == null || this.props.user.profile.surname == null ? "-" : this.props.user.profile.name + " " + this.props.user.profile.surname}</Table.Cell>
            </Table.Row>   .....

如果用户信息是从同一页面收集的,您可以使用用户信息而不作为道具传递,或者您可以将用户信息分配给您收集的页面的变量并尝试导入到 MyDoc()。