리액트 중에 다른페이지로 넘어가는 Link to = "" 여기서 변수를 좀 넣고싶은데 ` ` 가 안되더라구여 혹시 이런 경험 있으신분 계실까요?
|
답변 2개 / 댓글 2개
채택된 답변
+20 포인트
2021-08-02 (월) 12:37:19
<Link to={`/detail?id=${post.id}`} />
답변에 대한 댓글 1개
2021-08-02 (월) 12:02:26
어떻게 넣으셨는지 소스첨부를해주세요.
답변에 대한 댓글 1개
2021-08-02 (월) 12:20:39
posts.map(function(post,i){
return <>
<Link to=`/detail?id=${post.id}`>
<div className="post">
<figure className="thumbnail">
<img src="./img/test.jpg" alt=""/>
</figure>
<div className="text_wrap">
<p className="post_title">{post.title}</p>
<p className="post_text">{post.text}</p>
<p className="post_date">{post.date}</p>
</div>
</div>
</>
입니다
return <>
<Link to=`/detail?id=${post.id}`>
<div className="post">
<figure className="thumbnail">
<img src="./img/test.jpg" alt=""/>
</figure>
<div className="text_wrap">
<p className="post_title">{post.title}</p>
<p className="post_text">{post.text}</p>
<p className="post_date">{post.date}</p>
</div>
</div>
</>
입니다
답변을 작성하려면 로그인이 필요합니다.