import axios from 'axios'; import React, { useEffect, useState } from 'react'; import { Modal, Container, Row, Button, } from 'react-bootstrap'; function Place(props) { <<<<<<< HEAD const [reviews, setReviews] = useState([{ title: "", link: "", summery: "", content: "" }]) const getReview = () => { axios.get(`/api/review/${props.search.name}`)//review를 서버에 연결해서 .then(res => {s ======= const [reviews, setReviews] = useState() const [db, setDb] = useState(false) const getReview = () => { axios({ url: `/api/review?keyword=${props.place.name}`, method: 'post', data: { db: db } }) .then(res => { >>>>>>> origin/cherry console.log("place res.data", res.data) setReviews(res.data) }) .catch(err => { console.log(err) }) } useEffect(() => { getReview(); }, []) return ( {props.index + 1}. {props.place.name} {Array.isArray(reviews) ? reviews.map((review, index) => { return ( {review.title}
{review.summary}
{review.content}
) }) : "리뷰가 없습니다."}
); } export default Place;