qr_id route php getDog
This commit is contained in:
@ -5,6 +5,7 @@ import "./App.css";
|
||||
import Login from './components/Login';
|
||||
import Register from './components/Register';
|
||||
import Home from './components/Home';
|
||||
import Dog from './components/Dog';
|
||||
|
||||
type UserT =
|
||||
{
|
||||
@ -28,6 +29,7 @@ function App()
|
||||
{ user && <Route path="/" element={<Home/>} /> }
|
||||
{user && (
|
||||
<>
|
||||
<Route path="/:qr_id" element={<Dog/>} />
|
||||
<Route path="/login" element={<Login/>} />
|
||||
<Route path="/reg" element={<Register/>} />
|
||||
</>
|
||||
|
||||
13
src/components/Dog.tsx
Normal file
13
src/components/Dog.tsx
Normal file
@ -0,0 +1,13 @@
|
||||
import React from 'react'
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
export default function Dog()
|
||||
{
|
||||
const params = useParams();
|
||||
return (
|
||||
<div>
|
||||
<h1>Dog</h1>
|
||||
<p>{Object.keys(params)[0]}: {Object.values(params)[0]}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user