use-http
use-http copied to clipboard
Fetch is called in spite of conditional variables are undefined
Describe the bug Fetch is called in spite of conditional variable value is undefined
⚠️ Make a Codesandbox ⚠️
const {data} = useFetch(`/api/product/${id}`, {}, [id]);
Expected behavior Fetch shouldn't call the api when the conditional variables are undefined
- you can just do
useFetch(`api/product/${id}`, [id]) - this is a feature that would need to be implemented. I'm open to it. Submit a PR. I think the best way to do this would be to check if the dependency is
undefined.