I want to use async post-get request in useEffect hooks. Is this a optimize solition?
useEffect(() => { await Axios.get("some url").then(async(res) => { console.log(res); }).catch(async(err) => { console.log(err) }) }, [isFocused]) I want to use async post-get request in useEffect hooks. Is this a optimize solition?
useEffect(() => { await Axios.get("some url").then(async(res) => { console.log(res); }).catch(async(err) => { console.log(err) }) }, [isFocused]) I think you can use redux-saga and redux-thunk. But for this problem you can use call another function in your effect function.
useEffect(() => { const fetchData = async () => { await Axios.get("some url").then(async (res) => { console.log(res); }).catch(async (err) => { console.log(err) }) } fetchData(); }, [isFocused])