I get data from API but I cant set it to state, returns null.
useEffect(async () => {
await axiosClient.get(`/api/search`).then((res) => setQuery(res.data)).finally(() => setLoading(false));;
console.log(query)
}, []);
When i do console.log(res.data) It returns proper data but when I set it state returns null.