Skip to content

Commit

Permalink
Merge pull request #58 from obb8923/master
Browse files Browse the repository at this point in the history
cap
  • Loading branch information
obb8923 authored May 8, 2024
2 parents a097c5b + c40e230 commit 506c6a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
4 changes: 1 addition & 3 deletions front/src/components/PostFragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import parse from 'html-react-parser';

function PostFragment(props){
const navigate = useNavigate();
console.log("fragment props: ",props);
console.log("fragment postId : ",props.postId);
return (<>
<article onClick={() =>{navigate(`/post/${props.postId}`,{state:{postId:props.postId}})}}>
<article onClick={() =>{navigate(`/post/${props.postId}`)}}>
<div className={styles.fragmentBody}>
{parse(props.post)}
</div>
Expand Down
11 changes: 4 additions & 7 deletions front/src/components/PostViewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import ScrollView from "./ScrollView";
import styles from "../css/PostViewPage.module.css";
import React from 'react';
import { useEffect,useState } from 'react';
import { useLocation,Link } from 'react-router-dom';
//import parse from 'html-react-parser'; // HTML 문자열을 React 구성 요소로 변환
import { useParams,Link } from 'react-router-dom';
import parse from 'html-react-parser'; // HTML 문자열을 React 구성 요소로 변환

function PostViewPage() {

const location = useLocation();
const { state } = location;
const postId = state ? state.postId : null; // state가 null이 아닌지 확인
const {postId}=useParams();
const [blurBoxDisplay,setBlurBoxDisplay] = useState("flex");
const [buttonDisplay,setButtonDisplay] = useState("block");
const[data,setData]=useState({});
Expand Down Expand Up @@ -41,7 +38,7 @@ function PostViewPage() {
<article>
<div className={styles.postBox}>
{console.log(data.body)}
{data.body}
{parse(data.body)}
{/* data.body 에 html 정보가 저장될 예정, 정보를 변환시켜야함 */}
</div>
</article>
Expand Down

0 comments on commit 506c6a9

Please sign in to comment.