简体   繁体   中英

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"). I mean when we click on email id then the modal should get popup instead of showing button "show modal". 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 "

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:

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

See sandbox attached

编辑 SO 答案 - 60873116

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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