You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
830 B
39 lines
830 B
1 year ago
|
import './App.css';
|
||
|
import { Link, Route, Routes, useNavigate } from 'react-router-dom';
|
||
|
import Home from './components/Home';
|
||
|
import { Button } from 'antd';
|
||
|
|
||
|
|
||
|
const Categories = () => (
|
||
|
<div>
|
||
|
<h2>Categories</h2>
|
||
|
<p>Browse items by category.</p>
|
||
|
</div>
|
||
|
);
|
||
|
|
||
|
function App() {
|
||
|
const navigate = useNavigate();
|
||
|
const a = 1;
|
||
|
function GoHome(){
|
||
|
alert("go home")
|
||
|
navigate('/home?a=' + a)
|
||
|
}
|
||
|
return (
|
||
|
<div className="App">
|
||
|
<div>
|
||
|
<br></br>
|
||
|
<Link to="/home">Home</Link>
|
||
|
<Link to="/categories">categories</Link>
|
||
|
<Button type="primary" onClick={() => GoHome}>GO HOME</Button>
|
||
|
</div>
|
||
|
<Routes>
|
||
|
<Route path="/home" element={<Home />} />
|
||
|
<Route path="/categories" element={<Categories />} />
|
||
|
</Routes>
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
|
||
|
export default App;
|