🎃

JWT Authentication【14react-router-dom】

2022/10/16に公開

JWT Authentication【14react-router-dom】

YouTube: https://youtu.be/MBz_zGloddQ

src/pages/Home.tsx
const Home = () => {
  return (
    <div>Home</div>
  )
}

export default Home
src/pages/Login.tsx
const Login = () => {
  return (
    <div>Login</div>
  )
}

export default Login
src/pages/Protected.tsx
const Protected = () => {
  return (
    <div>Protected</div>
  )
}

export default Protected
src/App.tsx
import { BrowserRouter, Routes, Route } from 'react-router-dom'
import './App.css';
import Home from './pages/Home';
import Login from './pages/Login';
import Protected from './pages/Protected';

function App() {
  return (
    <BrowserRouter>
      <Routes>
        <Route path='/' element={<Home />} />
        <Route path='/login' element={<Login />} />
        <Route path='/protected' element={<Protected />} />
      </Routes>
    </BrowserRouter>
  );
}

export default App;

Discussion