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

145
Visualizações
Compiled with problems

I have a problem with react-router-dom and Prompt. The problem is Prompt' (imported as 'Prompt') was not found. Has something changed in the new versions?

Here is my code:

import React from 'react';
import '../styles/ContactPage.css';
import { Prompt } from 'react-router-dom';

class ContactPage extends React.Component {
    state = {
        value: ''
    }
    handleSubmit = e => {
        e.preventDefault();
        this.setState({
            value: '',
        })
    }
    handleChange = e => {
        this.setState({
            value: e.target.value,
        })
    }

    render() {
        return (
            <div className='contact'>
                <form>
                    <h3>Send a form</h3>
                    <textarea value={this.state.value} onChange={this.handleChange} placeholder='write something'></textarea>
                    <button onSubmit={this.handleSubmit}>Send</button>
                </form>
                <Prompt when={true} message={"You did not end your form. Are you sure you want to change a page? All data will be lost"} />
            </div>
        );
    }
}

export default ContactPage;
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The documentation has a guide for upgrading from v5 to v6 which says:

<Prompt> is not currently supported

<Prompt> from v5 (along with usePrompt and useBlocker from the v6 betas) are not included in the current released version of v6. We decided we'd rather ship with what we have than take even more time to nail down a feature that isn't fully baked. We will absolutely be working on adding this back in to v6 at some point in the near future, but not for our first stable release of 6.x.

Stick to v5 if you want to use it.

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