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

104
Visualizações
Status does not change when I delete data from here
const [products, setProducts] = useMangeProduct([]);
const handelDeleteProduct = id => {
        const url = `https://fierce-everglades-14403.herokuapp.com/product/${id}`;
        fetch(url, {
            method: 'DELETE',
        }).then(res => res.json())
            .then(data => {
                console.log(data);
                if (data?.acknowledged === true) {
                    const restProducts = products.filter(product => product._id !== id)
                    setProducts(restProducts);
                    toast.error('Product Delete successfully')
                }
            })
    }

** state Change** data deleted but state not change. if I reload the page so I can see my data is deleted. But when I click on the delete button, there is no change.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You mean that way?

let sure = confirm('Do you want to delete your constumer?');
if (sure) {
    // code to send fetch to your server
}
about 4 years ago · Juan Pablo Isaza Relatório

0

I have used something like this for Anchor Link. Hope that helps.

<a href="#" onclick="if (confirm('Do you really want to delete this User?')) {return true;}else{event.stopPropagation(); event.preventDefault();};"> Delete User </a>
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