use-http
use-http copied to clipboard
does post can auto fire?
can anyone tell me , the post fetch can run onmount or onupdate ?
@bbaduser You can do it by calling the function post function from useEffect
const { loading,error,data = [] } = useFetch('...',options,[]);
useEffect(()=>{
post();
},[]);
Are asking about doing it by default by useFetch it self as we do it for get ?
Yes, const { data, loading } = useFetch('url', { method: 'post' }, [])