Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
how to get the id of the card in which the button is selected in REACT

hope you're doing well! after having succefully getting all the experiences from the database and saved that in a state (experiences) like the code shows. I'm trying now to get the current selected experience when clicking on the Validate button( to update a field in this current experience selected ) and then deleting the card in which I clicked the button this is the code :

function Tables() {

  const [experiences, setExperiences] = useState(null);
useEffect( () => {

 const response = /*some code to get the experiences*/
      
 setExperiences(response.experiences);
 setIsPending(false);

  },[experiences]);

 function showConfirm(values) {
    confirm({
      title: 'Do you Want to Validate this Experience?',
      content: 'Some descriptions',
      onOk() {
        console.log('Yes');
    //await contract.methods.validateExperience("titrePoste", account[0]).send({ from: account[0] });
    console.log(values.id);
      },
      onCancel() {
        console.log('Cancel');
      },
    });
  }
return (
    <>
<Row gutter={[24, 24]}>
              {isPending && <div>Loading ... </div>}
              {experiences && experiences.map((experience, index) => (
                <div key = {experience.id} >
                  {
                    experience.valide
                      ? <p></p>
                      
                      : <Col span={24} >
                      <Card className="card-billing-info" bordered="false">
                        <div className="col-info">
                          <Descriptions title={experience.titrePoste}>
                            <Descriptions.Item label="Job Title" span={3}>
                              {experience.titrePoste}
                            </Descriptions.Item>
                            <Descriptions.Item label="Description" span={3}>
                              {experience.description}
                            </Descriptions.Item>
                          </Descriptions>
                        </div>
                        <div className="col-action">
                          <Button type="link" danger onClick={showDeleteConfirm}>
                            {deletebtn}DELETE
                          </Button>
                          <Button type="link" onClick={showConfirm}>
                            {<CheckOutlined />} VALIDATE
                          </Button>
                        </div>
                      </Card>
                      </Col>

                  }
                  </div>
              ))}
            </Row>
   </>
  );
}``` 
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can pass the iterated experience to showConfirm or showDelete functions like:

<Button type="link" onClick={() => showConfirm(experience, index)}>
  <CheckOutlined /> VALIDATE
</Button>

with this clicked experience as param, yours will be values, you can did what you want.

you will have the clicked experience and her index if needed

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda