I have these two custom react hooks using as below passing the same variables in object destructuring.
const {data, loading, error} = useFetch(url);
const {data, loading, error} = usePostForm(url);
of course, this won’t work because it’s using the same variables.
what’s the best way to change this codes? without changing original custom hooks
Only way I can do is as below codes; but my problem is there is no way to know what are the objects/data are returning from custom hooks.
const fetch1 = useFetch(url)
const fetch2 = usePostForm(url)
fetch1.data fetch1.error fetch1.loading
fetch2.data fetch2.error fetch2.loading
Anyone has better idea ? please let me know