import axios from 'axios'; import React, { useEffect, useState } from 'react'; import { Modal, Container, Row, Button, } from 'react-bootstrap'; function Place(props) { 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 => { console.log("place res.data", res.data) setReviews(res.data.review) setDb(res.data.db) console.log(db) }) .catch(err => { console.log(err) }) } useEffect(() => { getReview(); }, []) return ( {props.place.name} {Array.isArray(reviews) ? reviews.map((review) => { return ( {review.title}
{review.summary}
{review.content}
) }) : "리뷰가 없습니다."}
); } export default Place;