Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

172
Vistas
Attempted import error: 'withRouter' is not exported from 'react-router'

This is the code I am using for a register screen using React:

import React, { useCallback } from "react";
import { withRouter } from "react-router";
import app from "../Firebase/firebase";

const Register = ({history}) => {
    const handleSignup = useCallback(async event => {
        event.preventDefault()
        const { email, password } = event.target.elements;
        try {
            await app
                .auth()
                .createUserWithEmailAndPassword(email.value, password.value);
            history.push("/dashboard")
        } catch(error) {
            alert(error)
        }
    }, [history]);

    return (
        <div>
            <p>Register</p>
            <Form onSubmit={handleSignup}>
                <label>
                    Email
                    <input name="email" type="email" placeholder="Email" />
                </label>
                <label>
                    Password
                    <input name="password" type="password" placeholder="Password" />
                </label>
                <button type="submit">Register</button>
            </Form>
        </div>
    )
}

export default withRouter(Register)

I am getting the error mentioned in the title, what am I doing wrong here?

I'm also getting these errors when running npm i react-routerin the terminal: npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.16.0 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

you need to downgrade react-router and react-router-dom to version 5.

npm install react-router@5
npm install react-router-dom@5

I don't think Cube.js is maintained anymore. Probably best to find a different platform

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda