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

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

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 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!