In the below code Iam trying to use axios get request from await axios.get('/products/api')
is only working i can see the data in the console but forawait axios.get('/users/api')
Undefined is being returned on the console but when i try get request through Postman i can get the results .Iam stuck here.
”’ const [userdata, setuserdata] = useState([]);
const [products, setproducts] = useState([]);
useEffect(() => {
const fetchUserData = async () => {
const { users } = await axios.get('/users/api')
setuserdata(users);
const { data } = await axios.get('/products/api')
setproducts(data);
}
fetchUserData();
}, []);
console.log(products)
console.log(userdata)