import React, { useTransition } from "react"; import { Container, Col, Row, Image, Nav, Tab } from "react-bootstrap"; import { useState } from "react"; import { FaTaxi, FaHotel } from "react-icons/fa"; import { MdRestaurant } from "react-icons/md"; import AddNew from "./AddNew"; import ResourceListing from "./ResourceListing"; import { Link } from "react-router-dom"; import useGet from "../Hooks/useGet"; function ResourcesTab(props) { const [activeTab, setActiveTab] = useState(props.tab); // const [changed, setChanged] = useState(0); const userId = localStorage.getItem("userId"); const { data, setData, isLoading, getData, setChanged } = useGet(`${props.tab}/user/${userId}`); const handleSelect = (eventKey) => { setActiveTab(eventKey); console.log(props.refresh); props.refresh(eventKey); console.log("refresh" + eventKey); }; !isLoading && console.log(data); console.log(props.tab); return ( {props.tab == "/hotel" && !isLoading && data != null && data.map((hotel) => { return ( ); })} {props.tab == "/restaurant" && !isLoading && data != null && data.map((restaurant) => { console.log("mapiranje " + restaurant) return ( ); })} {props.tab == "/transport" && !isLoading && data.length > 0 && data.map((transport) => { return ( ); })} ); } export default ResourcesTab;