Created
December 28, 2021 16:47
-
-
Save onosendi/72402baeac05444365c3fa37b0a0ee83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Route, Routes } from 'react-router-dom'; | |
export default function App() { | |
return ( | |
<Routes> | |
<Route element={<Home />} path="/" /> | |
<Route element={<SomePage />} path="/somepage" /> | |
</Routes> | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function Home() { | |
const navigate = useNavigate(); | |
return <ToastButton handler={() => { navigate('/somepage'); }} />; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BrowserRouter as Router } from 'react-router-dom'; | |
ReactDOM.render( | |
<Router> | |
<App /> | |
</Router>, | |
document.getElementById('root'), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function SomePage() { | |
return <p>Some page</p>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment