import{Box, ScrollView} from "native-base"; import React, { useContext, useEffect, useState } from "react"; import { UserContext } from "../context/UserContext"; import { API } from "../environment/api"; import { CommentCard } from "./CommentCard"; export default function Home() { const { user } = useContext(UserContext) const [isRequesting, setIsRequesting] = useState(false); const [comments, setComments] = useState([]); useEffect(() => { console.log(user); const onRequestCommentsData = async () => { setIsRequesting(true); try { const jsonResponse = await fetch(`${API.BASE_URL}/post/allComments`, { method: "GET", headers: { 'Content-Type': 'application/json' } }) const response = await jsonResponse.json(); // console.log(response); setComments(response.message); } catch (error) { } setIsRequesting(false) } onRequestCommentsData() }, [user]) return ( { comments.map(item => ( )) } ) }