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

277
Vistas
React Router/History Can't Resolve "history/createBrowserHistory"

I cloned my react project today and the project was working fine on my other mac. Then I started to face some problems with my router, especially the history. The code in my history.ts is:

import createHistory from 'history/createBrowserHistory';

export default createHistory();

My app.tsxis:

import React from 'react';
import { Route, Router, Switch, } from 'react-router-dom';
import { connect } from 'react-redux';

import history from '../history';

const App = (props: any) => {
    return (
        <div>
            <Router history={history}>
                <div>
                    <Header/>
                    <Route path="/" exact component={Home}/>
                    <Route path="/about" exact component={About} />
                    <Route path="/media" exact component={Media}/>
                    <Switch>
                        <Route path="/login" exact component={Login}/>
                        <PrivateRoute path="/menu" exact component={Menu} auth={props.isSignedIn} />
                        <PrivateRoute path="/create" exact component={PostCreate} auth={props.isSignedIn} />
                        <PrivateRoute path="/delete/:id" exact component={PostDelete} auth={props.isSignedIn}/>
                    </Switch>
                </div>
            </Router>
        </div>
    );
};

I tried to change my history.ts to:

import { createBrowserHistory } from "history";
export default createBrowserHistory();

and no success, I also tried to change to

import { createBrowserHistory, History } from "history";
const history: History = createBrowserHistory();
export default history

And no success too, it's strange because my application was working fine months ago. I've searched all over Stack Overflow and no solution seems to fit. Any help will be appreciated.

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

0

I've solved, I noticed that the createBrowserHistory.d.ts weren't getting created. Probably because of my fault yarn install. I removed the project and re-cloned and installed the libraries using npmThen worked.

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