简体   繁体   English

如何使用 reactjs 显示内容而不显示按钮?

[英]How to show the content without showing button using reactjs?

My objective is to show only the email component while we click on emailid (instead of showing button namely "show modal").我的目标是在我们单击 emailid 时仅显示 email 组件(而不是显示按钮,即“显示模式”)。 I mean when we click on email id then the modal should get popup instead of showing button "show modal".我的意思是当我们点击 email id 时,模态应该弹出而不是显示按钮“显示模态”。 Can anyone help me with this problem to get solved?谁能帮我解决这个问题?

Here is the code:这是代码:

<Table.Body>
  <Table.Row>
    <Table.Cell>First Name</Table.Cell>
    <Table.Cell>
      <Link to="/Email">abc@yahoo.com</Link>
    </Table.Cell>
    <Table.Cell>01-01-2020</Table.Cell>
  </Table.Row>
</Table.Body>

Here is the whole code: " https://codesandbox.io/s/so-answer-60873116-98xnt "这是整个代码:“ https://codesandbox.io/s/so-answer-60873116-98xnt

Can anyone help me with this query?谁能帮我解决这个问题?

You want to add an open state and redirect to root on close, all this while using the open property of Modal component:您想添加一个open的 state 并在关闭时重定向到 root,所有这些都使用Modal组件的open属性:

<Container>
  <Modal
    open={this.state.open}
    onClose={() => {
      this.setState({ open: false });
    }}
  >
   ...
  </Modal>
  {!this.state.open && <Redirect to={`/`} />}
</Container>

See sandbox attached请参阅附加的沙箱

编辑 SO 答案 - 60873116

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM