In Reactjs Getting an error .map() is not a function – Javascript
when i try to fetch response from api i got map is not a function error .but i declared state as array. Here's the code: function VendorListScreen(){ const [vendorsList,setVendorsList]=useState([]); const getVendors =()=>{ axios.get('http://127.0.0.1:8000/api/vendors/').then((res)=>{ setVendorsList(res.data) }) } <h1>Vendor</h1> <button onClick={getVendors}>get</button> {vendorsList.map(vendor=>{…