Skip to content

Commit

Permalink
[ADD] 글쓰기 버튼 화면 이동 기능 추가 (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
ju1e3718 committed Jul 21, 2023
1 parent a0f8dfd commit a496e4a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions job1/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Home from "./View/Home";
import Laws from "./View/Laws";
import Board from "./View/Board";
import News from "./View/News";
import Write from "./View/Write";

function App() {
return (
Expand All @@ -16,6 +17,7 @@ function App() {
<Route path="/law" element={<Laws />} />
<Route path="/board" element={<Board />} />
<Route path="/news" element={<News />} />
<Route path="/write" element={<Write />} />
</Routes>
</Router>
</div>
Expand Down
10 changes: 8 additions & 2 deletions job1/src/Main/Preview.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import PrevCont from "./PrevCont";
import { Link } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom";
import "./Preview.css";
import { useState } from "react";

function Preview() {
const [section, setSection] = useState("hot");
const navigate = useNavigate();
const navigateToWrite = () => {
navigate("./write");
};
return (
<div className="previewContainer">
<h2 className="cHead">게시판</h2>
Expand All @@ -29,7 +33,9 @@ function Preview() {
NEW
</Link>
</div>
<button className="cWriteBtn">글쓰기</button>
<button className="cWriteBtn" onClick={navigateToWrite}>
글쓰기
</button>
</div>
<hr />
<PrevCont />
Expand Down
5 changes: 5 additions & 0 deletions job1/src/View/Write.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function Write() {
return <div>Write</div>;
}

export default Write;

0 comments on commit a496e4a

Please sign in to comment.