Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
YuHyun-P committed Jun 20, 2022
2 parents 012ae45 + d50b8b6 commit d30b352
Show file tree
Hide file tree
Showing 14 changed files with 164 additions and 5 deletions.
76 changes: 74 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
"@types/node": "^16.11.38",
"@types/react": "^18.0.12",
"@types/react-dom": "^18.0.5",
"@types/react-router-dom": "^5.3.3",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"typescript": "^4.7.3",
"web-vitals": "^2.1.4"
Expand Down
9 changes: 6 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
function App() {
return <></>;
}
import React from "react";
import AppRouter from "./routes/Router";

const App: React.FC = () => {
return <AppRouter />;
};

export default App;
4 changes: 4 additions & 0 deletions src/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const NotFound: React.FC = () => {
return <div>404 NOT FOUND</div>;
};
export default NotFound;
4 changes: 4 additions & 0 deletions src/pages/create.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const Create: React.FC = () => {
return <div>Create</div>;
};
export default Create;
9 changes: 9 additions & 0 deletions src/pages/detail.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { useParams } from "react-router";

const Detail: React.FC = () => {
const { id } = useParams<Record<string, string>>();

console.log(id);
return <div>{id}Detail</div>;
};
export default Detail;
9 changes: 9 additions & 0 deletions src/pages/edit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { useParams } from "react-router";
const Edit: React.FC = () => {
const { id } = useParams<Record<string, string>>();

console.log(id);

return <div>{id}Edit</div>;
};
export default Edit;
4 changes: 4 additions & 0 deletions src/pages/home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const Home: React.FC = () => {
return <div>Home</div>;
};
export default Home;
9 changes: 9 additions & 0 deletions src/pages/profile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { useParams } from "react-router";

const Profile: React.FC = () => {
const { id } = useParams<Record<string, string>>();

console.log(id);
return <div>Profile</div>;
};
export default Profile;
4 changes: 4 additions & 0 deletions src/pages/result.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const Result: React.FC = () => {
return <div>Result</div>;
};
export default Result;
4 changes: 4 additions & 0 deletions src/pages/signIn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const SignIn: React.FC = () => {
return <div>SignIn</div>;
};
export default SignIn;
4 changes: 4 additions & 0 deletions src/pages/signUp.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const SignUp: React.FC = () => {
return <div>SignUp</div>;
};
export default SignUp;
30 changes: 30 additions & 0 deletions src/routes/Router.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { BrowserRouter, Routes, Route } from "react-router-dom";
import NotFound from "../pages/404";
import Create from "../pages/create";
import Detail from "../pages/detail";
import Edit from "../pages/edit";
import Home from "../pages/home";
import Profile from "../pages/profile";
import Result from "../pages/result";
import SignIn from "../pages/signIn";
import SignUp from "../pages/signUp";

const AppRouter: React.FC = () => {
return (
<BrowserRouter>
<Routes>
<Route index element={<Home />} />
<Route path="/signIn" element={<SignIn />} />
<Route path="/signUp" element={<SignUp />} />
<Route path="/create" element={<Create />} />
<Route path="/detail/:id" element={<Detail />} />
<Route path="/profile/:id" element={<Profile />} />
<Route path="/edit/:id" element={<Edit />} />
<Route path="/result/:id" element={<Result />} />

<Route path="/*" element={<NotFound />} />
</Routes>
</BrowserRouter>
);
};
export default AppRouter;
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"typeRoots" : ["./@types", "./node_modules/@types"],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
Expand Down

0 comments on commit d30b352

Please sign in to comment.