I have gone through several similar questions but could not find something that worked. I am trying to bring in BrowserRouter from react-router but it says:
Module '"../node_modules/@types/react-router"' has no exported member 'BrowserRouter'
as per another similar question on here, I did an npm install of @types/react and @types/react-router but saved as dev dependencies. they were already in my package.json but as regular dependencies. before this, they were giving a similar issue when doing import React from 'react'. It would say that those modules could not be found, same for router. then when i did the install, those errors went away but the BrowserRouter started showing this error. I did also try 'react-router-dom'.
import React from 'react';
import { BrowserRouter, Switch, Route } from 'react-router';
import './App.css';
import Recipes from './components/Recipes';
const App: React.SFC = () => {
return (
<BrowserRouter>
<main>
<Switch>
<Route exact path='/' component={Recipes} />
</Switch>
</main>
</BrowserRouter>
);
}
export default App;
Just expecting for the error to not be present and to be able to regularly navigate. This is my first time really using typescript.