Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

173
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!