Skip to content

Commit

Permalink
Basic Routing
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianWinner committed Mar 5, 2024
1 parent eb68d0b commit fa522be
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useState, useEffect } from 'react';
import { googleLogout, useGoogleLogin } from '@react-oauth/google';
import axios from 'axios';
import Settings from './settings';
import LoggedIn from './loggedIn';

interface User {
access_token: string;
Expand Down Expand Up @@ -64,6 +66,14 @@ function App() {
<button onClick={() => login()}>Sign in with Google 🚀</button>
)}
</div>
<div>
<Router>
<Routes>
<Route path="/loggedIn" element={<LoggedIn />} />
<Route path="/settings" element={<Settings />} />
</Routes>
</Router>
</div>
);
}

Expand Down
15 changes: 15 additions & 0 deletions src/loggedIn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';

const LoggedIn = () => {
const navigate = useNavigate();
const handleClick = () => navigate('/');
return (
<button type="button" onClick={handleClick}>
Go Home
</button>
);

}

export default LoggedIn;
15 changes: 15 additions & 0 deletions src/settings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';

const Settings = () => {
const navigate = useNavigate();
const handleClick = () => navigate('/');
return (
<button type="button" onClick={handleClick}>
Home
</button>
);

}

export default Settings;

0 comments on commit fa522be

Please sign in to comment.