我有这两个组件:
import React, { useState, useEffect } from "react";
import axios from "axios";
import Button from "../../../components/Button";
import NewAreaModal from "./NewAreaModal";
function GestioneAree() {
const [aree, setAree] = useState([]);
const [show, setShow] = useState(false);
useEffect(() => {
axios.get("http://localhost:8080/aree/all").then((res) => {
setAree(res.data);
console.log(res.data);
});
}, []);
const showModal = () => {
setShow(true);
}
return (
<div className="bg-white rounded-lg">
<div className="px-4 py-5 sm:px-6 rounded">
<div className="-ml-4 -mt-2 flex items-center justify-between flex-wrap sm:flex-nowrap">
<div className="ml-4 mt-2">
<h3 className="text-lg leading-6 font-medium text-gray-900">Aree nel …
Run Code Online (Sandbox Code Playgroud)