Trying to create a plain router with default history object, but its throwing this error -
Module not found: Error: Can't resolve 'history/createBrowserHistory'
In the App.js file -
import history from './history'
const App = () => {
return (
<div className="ui container" style={{marginTop: '50px'}}>
<Router history={history}>
<Header />
<Routes>
<Route path="/" exact element={<StreamList />} />
</Routes>
</Router>
</div>
);
};
In the history.js file -
import createHistory from 'history/createBrowserHistory'
export default createHistory();
I also tried the solution mentioned in Module not found: Error: Can't resolve 'history/createBrowserHistory', but now its not rendering the App component at all, and getting the following error in console
Uncaught TypeError: Cannot read properties of undefined (reading 'pathname') at Router
What could be the reason? I installed a separate history dependency, but its still not working.