Mostrará continuamente este error de que TypeError: post.map no es una función. por favor dame alguna respuesta apropiada guyz.
import React from "react"; import { useState } from "react"; function LoopThrough() { const [post, setpost] = useState(""); function getDataFromApi() { // using axios method axios .get("https://jsonplaceholder.typicode.com/posts") .then((get) => { console.log(get.data); setpost(get.data); }) .catch((error) => { console.log(error); }); } const getdatafromjson = post.map((myobj) => { return ( <div> <h2>{myobj.title}</h2> </div> ); }); return ( <> <h2>Return Html using http methods</h2> <button onClick={getDataFromApi}>Get Data</button> {getdatafromjson} </> ); } export default LoopThrough;Nota: En este ejemplo, quiero obtener datos de una Api externa usando el método Axios (idioma: React JS) y mostrarlos en la pantalla usando ganchos de reacción y el método map() pero no funciona.