'Using BrowserRouter v6, the webpage is not displayed no errors found
import './App.css';
import {BrowserRouter , Route, Routes} from "react-router-dom"
function App() {
return(
<>
<BrowserRouter>
<Navbar/>
<Routes>
<Title/>
<About/>
<SkillsSection/>
<Mywork/>
<Route exact path='/contact'>
<Contact/>
</Route>
</Routes>
<Footer/>
</BrowserRouter>
</>
)
}
export default App;
After applying the routes the web page is not being displayed in browser and there is no error in code so far
Solution 1:[1]
go through this link https://reactrouter.com/docs/en/v6/getting-started/overview
import ReactDOM from "react-dom/client";
import {
BrowserRouter,
Routes,
Route,
} from "react-router-dom";
// import your route components too
const root = ReactDOM.createRoot(
document.getElementById("root")
);
root.render(
<BrowserRouter>
<Routes>
<Route path="/content" element={<content />}>
</Route>
</Route>
</Routes>
</BrowserRouter>
);
Solution 2:[2]
you can do it automatically by a timer, after a period of time this timer will call your function. something like this:
bool? isLoading;
adClickedRunner() {
Timer(
Duration(seconds: 5), //example: after 5sec will call your task
() async {
isLoading = true; //to show circularProgressIndicatior for your button
Scaffold.of(context).showSnackBar(SnackBar(
content: Text('Ad is clicked'),));
isLoading = false;
},
);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Janith Herath |
| Solution 2 |
